Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I'm new to PowerBI and only basic understanding of DAX....
I would like to calculate the difference between two values in the same column. In this case I'm only interested in the difference between two jurisdictions at any one time (e.g. I'm interested in the difference between NSW and AUS only)
For example, if a user selects the Jurisdiction NSW and AUS the calculated column would show the difference between them (in this case I would expect +4.1)
Solved! Go to Solution.
First, if you want user interaction to influence the calculation, then you cannot use a calculated column, you would need to use a measure. Second, you will need to use slicers that are not related to your table. Easiest way to do that would be to use Create Table from the modeling tab and use:
DISTINCT('Table'[Jusisdiction])Check your relationships view and make sure that they are not related to your main table. Now that you have that, you can then create a measure like:
Measure =
VAR __slicer1 = MAX('Slicer1'[Jurisdiction])
VAR __slicer2 = MAX('Slicer2'[Jurisdiction])
VAR __value1 = MAXX(FILTER('Table',[Jurisdiction]=__slicer1),[Mean])
VAR __value2 = MAXX(FILTER('Table',[Jurisdiction]=__slicer2),[Mean])
RETURN
__value1 - __value2Something along those lines.
First, if you want user interaction to influence the calculation, then you cannot use a calculated column, you would need to use a measure. Second, you will need to use slicers that are not related to your table. Easiest way to do that would be to use Create Table from the modeling tab and use:
DISTINCT('Table'[Jusisdiction])Check your relationships view and make sure that they are not related to your main table. Now that you have that, you can then create a measure like:
Measure =
VAR __slicer1 = MAX('Slicer1'[Jurisdiction])
VAR __slicer2 = MAX('Slicer2'[Jurisdiction])
VAR __value1 = MAXX(FILTER('Table',[Jurisdiction]=__slicer1),[Mean])
VAR __value2 = MAXX(FILTER('Table',[Jurisdiction]=__slicer2),[Mean])
RETURN
__value1 - __value2Something along those lines.
Thank you! This worked with no issues 🙂
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 35 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 75 | |
| 72 | |
| 39 | |
| 35 | |
| 23 |