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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
water-guy-5
Helper III
Helper III

*** Compare averages versus goals

Hello, in this example I have two ways of approaching just not sure whats easiest

Lets say I have 5 locations, A-E. 

My table 'Transactions', records daily transaction amounts for all locations like this

waterguy5_0-1674847573577.png

What I want to do is rank the averge number of transactions for these locations. However, the problem is that for locations A, B, C and D, the goal is 500. For E (Since its larger) the goal is 750. Note: the goal is to get as close to the target as possible. Meaning too many is bad on costs (i know that doesnt make much sense but this is a dummy example for what im actually doing) and too little is also bad.

At a first glance this is really simple where all I would have to do use my average measure
Average Transactions = AVERAGE('Transactions'[Sales])

And then find difference from my target
Variance = ABS([AverageTransations] - 500) and then sort by largest difference.

The issue is that for location E I need to do this by 750.

Option 1: make an if statement, but when i do a measure it doesnt recognize location column and when I do a calculate column it doesnt calculate correctly.
Option 2: enter table manually and create a relationship
Location       Target
A                   500
B                    500
C                    500
D                   500
E                    750

Both have failed. Any ideas?

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @water-guy-5 

 

You can try the following methods.

vzhangti_0-1675058276220.png

Column:

Target = LOOKUPVALUE(Target[Target],Target[Location],[Location])

vzhangti_1-1675058308208.png

Measure:

Variance = ABS(AVERAGE('Table'[Sales])-SUM('Table'[Target]))
Rank = RANKX(FILTER(ALL('Table'),[Date]=SELECTEDVALUE('Table'[Date])),[Variance],,DESC)

vzhangti_2-1675058366432.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

1 REPLY 1
v-zhangti
Community Support
Community Support

Hi, @water-guy-5 

 

You can try the following methods.

vzhangti_0-1675058276220.png

Column:

Target = LOOKUPVALUE(Target[Target],Target[Location],[Location])

vzhangti_1-1675058308208.png

Measure:

Variance = ABS(AVERAGE('Table'[Sales])-SUM('Table'[Target]))
Rank = RANKX(FILTER(ALL('Table'),[Date]=SELECTEDVALUE('Table'[Date])),[Variance],,DESC)

vzhangti_2-1675058366432.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

May 2025 Monthly Update

Fabric Community Update - May 2025

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