Reputation: 11
I should start by saying I'm using a Live Connection over a Tabular model, so creating calculated columns with 'edit queries' is not an option unfortunately. Here's what my data looks like, with expected results:
In my table visual, I need to create a measure that will rank my CASE_IDs, from '1' to 'N', whenever a CASE_ID has more than 1 SUB_CASE_IDs. My end goal: to have a distinct values of CASE_IDs. After the measure is created, the idea is to filter out all the rows that are different than 1.
Some key points if I may:
Hope I'm clear enough. Any help would be greatly appreciated!
Upvotes: 1
Views: 193
Reputation: 16908
If there are no duplicate sub_case_id for a case_id, this following measure can give your expected output-
row_number =
CALCULATE(
COUNTROWS(your_table_name),
FILTER(
ALLEXCEPT(
your_table_name,
your_table_name[case_id]
),
your_table_name[sub_case_id] <= MIN(your_table_name[sub_case_id])
)
)
Now, if you need to keep selected filters, the Measure will be bit different as below-
row_number =
CALCULATE(
COUNTROWS(your_table_name),
FILTER(
ALLSELECTED(your_table_name),
your_table_name[sub_case_id] <= MIN(your_table_name[sub_case_id])
&& your_table_name[case_id] = MIN(your_table_name[case_id])
)
)
Here is the sample output-
Upvotes: 0
Reputation: 3741
You can try this solution:
Rank = CALCULATE(
COUNTROWS('Table1'),
FILTER(
ALL(Table1),
'Table1'[case_id] = EARLIER('Table1'[case_id]) &&
'Table1'[SomeOfYourValueColumn] > EARLIER('Table1'[SomeOfYourValueColumn])
)
)+1
Upvotes: 1