Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
H Everyone, Question on Filter Sequence Based Max value
This is how my table Looks currently
Policy Master | Policy Number | Sequence |
1234uw | WCE2144 | 1 |
1234uw | WC23333 | 2 |
1234uw | WCE222313 | 4 |
1234uw | 12ERRRR | 3 |
21ECRC | 23ECRT | 1 |
212345 | 2C3444 | 2 |
So from the set above i would need to find the Policy Number Associate with each set of Policy Master based on Max of Sequence .
Then i would have to do a count of all such policies.
Appreciate if anyone could help on this quick.
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario.
Table:
You may two measures as below.
Count =
var _policymaster = SELECTEDVALUE('Table'[Policy Master ])
return
CALCULATE(
DISTINCTCOUNT('Table'[Policy Number ]),
FILTER(
ALLSELECTED('Table'),
'Table'[Policy Master ]=_policymaster&&
'Table'[Sequence]=
CALCULATE(
MAX('Table'[Sequence]),
FILTER(
ALLSELECTED('Table'),
'Table'[Policy Master ]=_policymaster
)
)
)
)
CountTotal =
SUMX(
SUMMARIZE(
'Table',
'Table'[Policy Master ],
"Count",
var x = 'Table'[Policy Master ]
return
CALCULATE(
DISTINCTCOUNT('Table'[Policy Number ]),
FILTER(
ALLSELECTED('Table'),
'Table'[Policy Master ]=x&&
'Table'[Sequence]=
CALCULATE(
MAX('Table'[Sequence]),
FILTER(
ALLSELECTED('Table'),
'Table'[Policy Master ]=x
)
)
)
)
),
[Count]
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
You can create two calculated columns as follows:
@Anonymous
create a desc rank policy master sequence and filter on 1
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
The file is created after the signature. Created as column
@amitchandak Thanks for the quick response,
while it did answer on how i can pull a unique row from the Rank Function.
I'm still not sure on how to take a count of Policy number (Policy Number from my example table ) from the derived unique row for the output of Rank function.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
87 | |
81 | |
53 | |
38 | |
35 |