Forum Discussion
Help with Variance calculation with current month vs selected month from slicer
- 5 years ago
Hi, Diva20
It’s my pleasure to answer for you.
According to your description,You should have a date column or a date table, and your oppurtunities column seems to be a measure, so ,you can add a separate month column as a slicer through ‘enter data’,then create a measure to calculate the desired result.
Like this:
Variance P + Companies = VAR a = SELECTEDVALUE ( 'Table (2)'[Month] ) VAR b = CALCULATE ( [Measure], FILTER ( ALL ( 'Table' ), 'Table'[Month] = SELECTEDVALUE ( 'Table'[Month] ) ) ) VAR c = CALCULATE ( [Measure], FILTER ( ALL ( 'Table' ), 'Table'[Month] = SELECTEDVALUE ( 'Table (2)'[Month] ) ) ) RETURN IF ( ISBLANK ( [Measure] ), 0, c - b )Here is my sample .pbix file.Hope it helps.
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Diva20
It’s my pleasure to answer for you.
According to your description,You should have a date column or a date table, and your oppurtunities column seems to be a measure, so ,you can add a separate month column as a slicer through ‘enter data’,then create a measure to calculate the desired result.
Like this:
Variance P + Companies =
VAR a =
SELECTEDVALUE ( 'Table (2)'[Month] )
VAR b =
CALCULATE (
[Measure],
FILTER ( ALL ( 'Table' ), 'Table'[Month] = SELECTEDVALUE ( 'Table'[Month] ) )
)
VAR c =
CALCULATE (
[Measure],
FILTER (
ALL ( 'Table' ),
'Table'[Month] = SELECTEDVALUE ( 'Table (2)'[Month] )
)
)
RETURN
IF ( ISBLANK ( [Measure] ), 0, c - b )Here is my sample .pbix file.Hope it helps.
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.