Forum Discussion
DAX Code
- 1 year ago
Hi Singh_Yoshi
If you want to compare models using two slicer then you need duplicate your table
and then use below DAX measureStep 1 :Create Duplicate Table(Ex. Duplicate Table1 and name it Table2)
Step 2 :Add two slicers based on Table1[Model Code] and another based on Table2[Model Code]
Step 3 :Creating DAX Measures for Selected Models--Measure
In Table1
SelectedModel1 = SELECTEDVALUE('Table1'[Model Code])In Table2
SelectedModel2 = SELECTEDVALUE('Table2'[Model Code])Step 4 : Comparison Measures
MSRPComparison =
VAR Model1 = [SelectedModel1]
VAR Model2 = [SelectedModel2]
RETURN
IF (
NOT (ISBLANK(Model1)) && NOT (ISBLANK(Model2)),
CALCULATE (
SUM('Table1'[MSRP]),
'Table1'[Model Code] = Model1
) -
CALCULATE (
SUM('Table2'[MSRP]),
'Table2'[Model Code] = Model2
),
BLANK()
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Singh_Yoshi ,
You should create slicerTable to select Mode Code. And then use below formula to create measure:
SelectedModel1 = SELECTEDVALUE(slicer1[Model code],"None")SelectedModel2 = SELECTEDVALUE(slicer2[Mode code],"None")MSRP_Difference =
VAR Model1 = [SelectedModel1]
VAR Model2 = [SelectedModel2]
RETURN
CALCULATE ( SUM ( 'Table'[MSRP] ), 'Table'[Model code] = Model1 )
- CALCULATE ( SUM ( 'Table'[MSRP] ), 'Table'[Model code] = Model2 )
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.