We'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
Hello community,
I have a calculation group where I have a couple of calculation items, which perform a SUMX of a measure SUM(kg) and a referenced table with several columns, where I have the prices at a certain implementation date, e.g.
Jan21:
SUMX (
'BX_Table',
SELECTEDMEASURE()
* RELATED ( 'VRP Prices'[01.01.2021] )
)
Jun21:
SUMX (
'BX_Table',
SELECTEDMEASURE()
* RELATED ( 'VRP Prices'[01.06.2021] )
)via a slicer on the calculation group, the user can chose the price applied to the SELECTEDMEASURE(kg) he wants to see. That works fine.
What I want to achieve now, is a DIVIDE or subtraction when two Calculation Items are chosen. I wouldn't mind if the formular breaks when more then two Calculation Items are chosen - in the first instance, I just want to show the % between the value June vs January.
My first attempt was at reading out the Calculation items used, but this does not seem to work. Has anyone an idea?
Thanks a lot!
Solved! Go to Solution.
I think I got the syntax for TREATAS wrong, try using VALUES( CalcGroupSlicer1[Name])
Hello @johnt75
thanks for your suggestion, however it won't work for me. I tried several things, but maybe I am misinterpreting your formular:
In the comparison measure, the TREATAS function always gives me an error. Is the Expression missing?
I have as a first snippet:
Comparison Measure =
VAR firstValue =
CALCULATE(
[Summe Gewicht kg], //this is my base measure, also used for Calculation Group
TREATAS(CalcGroupSlicer1[Name], ImplementaionDateSelection[Name])) //first element is underlined red, and following the syntax an expression is needed here. However, I cannot insert SELECTEDVALUE(CalcGroupSlicer1[Name]) so I don't know what expression is needed.
looking at your formular, it looks like you have two columns in your TREATAS, but this throws an error?
I think I got the syntax for TREATAS wrong, try using VALUES( CalcGroupSlicer1[Name])
You could create 2 new copies of your calculation group table just for use on the slicers.
Calc slicer 1 = VALUES('Calculation Group')
Calc slicer 2 = VALUES('Calculation Group')Do not create any relationships from these tables, leave them totally disconnected.
You can then create measure to perform your division or subtraction or whatever like
Comparison measure =
var firstValue = CALCULATE( [Base measure], TREATAS( 'Calc slicer 1'[Calc item], 'Calculation Group'[Calc item]) )
var secondValue = CALCULATE( [Base measure], TREATAS( 'Calc slicer 2'[Calc item], 'Calculation Group'[Calc item]) )
return DIVIDE( firstValue, secondValue )
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 | |
| 38 | |
| 33 | |
| 17 | |
| 17 |
| User | Count |
|---|---|
| 67 | |
| 62 | |
| 38 | |
| 34 | |
| 22 |