Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

var/return

 

i am trying to put in these two measures

 

now_termination = RANKX(ALL( Matrix_tab[NC]), [Termination Rank_1])
Termination Rank_1 = CALCULATE(SUMX(Matrix_tab,Matrix_tab[Termination_1]),FILTER(Matrix_tab,Matrix_tab[Void month]))

 

 into 

 

measure =
VAR term1 = CALCULATE(SUMX(Matrix_tab,Matrix_tab[Termination_1]),FILTER(Matrix_tab,Matrix_tab[Void month]))
return
RANKX(ALL( Matrix_tab[NC]), term1)


 

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous , 

I am not sure your data structure, you could refer to my sample for details. If this is not what you want, please correct me and inform me more detailed information(such as your expected output and your sample data)? Then I will help you more correctly.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

what is the question?

Anonymous
Not applicable

I am trying to use the rankx function
when i try
 RANKX(   ALL(Table[column1]),
                                  CALCULATE(SUMX(Table, Table[column2]),FILTER(Table,Table[month]))

 it gives the contant ranking of 1
except i use 2 different measures

 

Measure2 = RANKX(ALL( table[column1]), Measure1)
measure1= CALCULATE(SUMX(Table ,Table[Column2),FILTER(Table,Table[month]))

 

so 


i was wonering if its is possible to  infuse 

 

 



 

@Anonymous 

 

I have seen this recurrenlty, including when using VAR in some instances - and it gets frustrating at times. Unfortunately my knowledge of the intricacies of DAX is insuffucient to provide an adequate answer (we need some help from the DAX gurus).

Some time back, in a thread discussing why VAR clauses sometimes did not deliver the expected result, @MattAllington  recommended wrapping calculations in VAR clauses in a CALCULATE function. In my exerience, this works sometimes, others the only way I have succeeded in getting the expected result is to unfold the measure into two, as you have done. What's worse is that I often come to this conclusion after spending "hours" trying to understand what is wrong or going on...very frustrating.

As I say, there must be an explanation (which may well be that there is something wrong in the model or my DAX), but it is beyond the scope of my knowledge of the intricacies of the DAX engine.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

So, let's see if I can GUESS what you want to do...

 

You have one measure with a CALCULATE inside a RANKX and if you divide the formula in two different measures, they give you different results?

 

 

Anonymous
Not applicable

Yes, That is correct.

dax
Community Support
Community Support

Hi @Anonymous , 

Could you please tell us if your question has been resolved. If so, in order to close the thread, please kindly mark helpful replies as answers. By doing so, it will benefit all community members who are having this similar issue. Your contribution is highly appreciated.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Anonymous , Hope above solution has worked for you

dax
Community Support
Community Support

Hi @Anonymous , 

I am not sure your data structure, you could refer to my sample for details. If this is not what you want, please correct me and inform me more detailed information(such as your expected output and your sample data)? Then I will help you more correctly.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Can you share sample data and sample output.Thanks.
Proud to be a Datanaut My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.