Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi, I am struggling to come up with a DAX solution to compute the differences of multiple selected forecast versions.
First, I will select two forecast versions on my slicers, which will be shown across 12 months in a table.
Next, I want to derive the difference between the two versions by months as a comparison in the last line:
My current dataset is modelled as follows.
The column under Version contains columns consisting from Apr-24 to Mar-25 sequentially, and period runs from JAN to DEC:
Thanks and appreciate any help gathered.
Solved! Go to Solution.
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
INDEX function (DAX) - DAX | Microsoft Learn
expected result measure: =
VAR _diff =
CALCULATE (
SUM ( forecast[Value] ),
INDEX (
1,
ALLSELECTED ( forecast[Version], forecast[Version sort] ),
ORDERBY ( forecast[Version sort], ASC )
)
)
- CALCULATE (
SUM ( forecast[Value] ),
INDEX (
1,
ALLSELECTED ( forecast[Version], forecast[Version sort] ),
ORDERBY ( forecast[Version sort], DESC )
)
)
VAR _result =
CALCULATE (
SUM ( forecast[Value] ),
KEEPFILTERS ( forecast[Version] IN VALUES ( 'version'[Version] ) )
)
RETURN
IF (
HASONEVALUE ( 'version'[Version] ),
SWITCH (
TRUE (),
COUNTROWS ( VALUES ( forecast[Version] ) ) = 2, IF ( SELECTEDVALUE ( 'version'[Version] ) = "Difference", _diff, _result )
)
)
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
INDEX function (DAX) - DAX | Microsoft Learn
expected result measure: =
VAR _diff =
CALCULATE (
SUM ( forecast[Value] ),
INDEX (
1,
ALLSELECTED ( forecast[Version], forecast[Version sort] ),
ORDERBY ( forecast[Version sort], ASC )
)
)
- CALCULATE (
SUM ( forecast[Value] ),
INDEX (
1,
ALLSELECTED ( forecast[Version], forecast[Version sort] ),
ORDERBY ( forecast[Version sort], DESC )
)
)
VAR _result =
CALCULATE (
SUM ( forecast[Value] ),
KEEPFILTERS ( forecast[Version] IN VALUES ( 'version'[Version] ) )
)
RETURN
IF (
HASONEVALUE ( 'version'[Version] ),
SWITCH (
TRUE (),
COUNTROWS ( VALUES ( forecast[Version] ) ) = 2, IF ( SELECTEDVALUE ( 'version'[Version] ) = "Difference", _diff, _result )
)
)
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 58 | |
| 53 | |
| 43 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 122 | |
| 108 | |
| 44 | |
| 32 | |
| 24 |