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

Measures with and without Variables result in different values

When a variable is used, ranking does not seem to function properly.

Can someone explain me what’s going on? Please see the screenshot below.

 

image.pngimage.png

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

In my opinion,

 

The Third one:

when a VAR is created inside a measure for creating a number, the result of VAR inside the measure is fixed, which means it always shows one number.

 

The second one:

I think you can put CALCULATE function inside your second measure, which looks something like below.

 

Picture1.png

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

Thanks for that ... yeah it worked .. but there must be a way to get around using Variables I believe ?

Hi, @Anonymous 

Thank you for your feedback.

It might be helpful for me if I can understand the reason why you want to use VAR inside the measure.

At this moment, what I can think of is, creating a table by using VAR, not creating a number by using VAR. For instance, like the below.

 

Rank by Rev V3 =
VAR newtable =
SUMMARIZE ( ALL ( 'Table' ), 'Table'[item] )
RETURN
RANKX ( newtable, CALCULATE ( SUM ( 'Table'[rev] ) ) )

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


amitchandak
Super User
Super User

@Anonymous , put a calculate in second one and try

calculate(Sum(Sample_data[turnover]))

Anonymous
Not applicable

I have already tried it all and it is not working 

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.