Forum Discussion
Top 5 By Two different Conditions
- 6 years ago
Hi Anonymous
I've attached a file with a solution.
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
LinkedIn
Hi Anonymous
Try this Measure
SpendTop5=
VAR __topN = 5
VAR __associate =
RANKX (
ALL ( 'Table'[Associate] ),
CALCULATE(
[spend],
ALLEXCEPT( 'Table', 'Table'[Associate] ) ),
,
DESC,
DENSE
) <= __topN
VAR __division =
RANKX (
ALL ( 'Table'[Division] ),
CALCULATE(
[spend],
ALLEXCEPT( 'Table', 'Table'[Division] ) ),
,
DESC,
DENSE
) <= __topN
RETURN
IF( __division && __associate, [spend] )
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
Hi Mariusz,
Are these two seperate measures? I tried to create only one measure and not getting the desired Output i.e
SpendTop5=
VAR __topN = 5
VAR __associate =
RANKX (
ALL ( 'Table'[Associate] ),
CALCULATE(
[spend],
ALLEXCEPT( 'Table', 'Table'[Associate] ) ),
,
DESC,
DENSE
) <= __topN
VAR __division =
RANKX (
ALL ( 'Table'[Division] ),
CALCULATE(
[spend],
ALLEXCEPT( 'Table', 'Table'[Division] ) ),
,
DESC,
DENSE
) <= __topN
RETURN
IF( __division && __associate, [spend] )
See I am getting below output from your given DAX
Apologies, As I am noob in DAX queries.
Kindly Help.
- Mariusz6 years ago
Community Champion
Hi Anonymous
Can you share your DAX expression?
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
LinkedIn- Mariusz6 years ago
Community Champion
Hi Anonymous
I've attached a file with a solution.
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
LinkedIn- Anonymous6 years agoNot applicable
Hi Mariusz
Thank you so much for your suggestion. Here, I replaced All with All selected and now able to get the results.
The only change I have done here is that I am only fetching divsion from DAX Top 5 associate names are filtering out through powerbi Top N Filter option and for Category I am filtering through page level filter.
But its works and giving the correct output.
Below Is the query which I performed.
VAR __division = RANKX ( SelectedALL ( 'Table'[Division] ), CALCULATE( [spend], ALLEXCEPT( 'Table', 'Table'[Division] ) ), , DESC, DENSE ) <= __topN RETURN IF( __division && __associate, [spend] )Really appreciate your efforts.
Regards
Uphar Tandon