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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.