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
theunissenp
Helper I
Helper I

Measure to calculate delta between selected planning version

Hi all,

 

I'm trying to create a measure that will calculate the delta between selected planning version. My simplified datamodel is as follows:

 

Versionvalue
Planning_110
Planning_220
Planning_325
Planning_48

 

Result should be usable in a matrix visual:

column1: planning version A

column2: planning version b

column 3: delta 

 

Thanks you very much for your respons!

 

Regards,

 

Paul Theunissen

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @theunissenp 

One idea,

vxiaotang_0-1654247424287.png

create the measure

Measure = 
var _count= COUNTX(ALLSELECTED('Table'[Version]),[Version])
var _max= IF(_count=2,MAXX(ALLSELECTED('Table'),'Table'[value]))
var _min= IF(_count=2,MINX(ALLSELECTED('Table'),'Table'[value]))
return
IF(HASONEVALUE('Table'[Version]),SUM('Table'[value]),_max-_min)

 

Best Regards,

Community Support Team _Tang

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

View solution in original post

7 REPLIES 7
v-xiaotang
Community Support
Community Support

Hi @theunissenp 

One idea,

vxiaotang_0-1654247424287.png

create the measure

Measure = 
var _count= COUNTX(ALLSELECTED('Table'[Version]),[Version])
var _max= IF(_count=2,MAXX(ALLSELECTED('Table'),'Table'[value]))
var _min= IF(_count=2,MINX(ALLSELECTED('Table'),'Table'[value]))
return
IF(HASONEVALUE('Table'[Version]),SUM('Table'[value]),_max-_min)

 

Best Regards,

Community Support Team _Tang

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

Thanks! This helps a lot. One more question. Is it also possible to create a measure that calculates a difference for multiple dimension: Version, cost center and year, quarter and month?

example:

theunissenp_0-1655368497035.png

 

 

theunissenp
Helper I
Helper I

In the matrix the expected result shoud be:

when planing_1 and planning_2 are selected:

 

theunissenp_0-1654001128886.png

 

Hi:

I looked up a potential solution for you. Please check out this previous answer and I hope this helps!

 

https://community.powerbi.com/t5/Desktop/Compare-Data-based-on-2-selected-values-in-1-column/td-p/15...

Thanks for your help. Unfortunately this solution doesn't work for me... I get the message that I want to compare text with numbers

Whitewater100
Solution Sage
Solution Sage

Hi Paul:

 

Can you give sme examples of expected results? I'm not sure what you want to compare your selected value to? Thanks..

theunissenp_1-1655368561587.png

 

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.

Top Solution Authors