Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hello, I would like to obtain a measurement that returns the value of the previous month even if the date filter is unchecked.
I would like it to return the value of the month before the current month if the date filter is not selected.
In this first image the filters are selected and the returned value is correct.
However, in this second image with the filters unchecked, it returns the wrong value. I would like it to return the previous month of the current month.
Below is the DAX function I am using:
Solved! Go to Solution.
Your approach will fail because neither slicer is set to single select. You are allowing your users to select multiple months as well as multiple years, so "previous month" loses its meaning.
Hi @carlosroston ,
I create two tables as you mentioned.
Then I create two measures and here are their DAX codes.
Measure =
IF(
ISFILTERED('DateTable'[Month]),
CALCULATE(
SUM('SalesData'[SalesAmount]),
FILTER(
'DateTable',
'DateTable'[Month] = SELECTEDVALUE('DateTable'[Month])
)
),
CALCULATE(
SUM('SalesData'[SalesAmount]),
FILTER(
'DateTable',
'DateTable'[Month] = MONTH(TODAY()) - 1
)
)
)
Measure 2 = 'SalesData'[Measure] - 100
But as lbendlin said, you have to keep an option in Slicer or you won't be able to accomplish what you want to accomplish.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @carlosroston ,
I create two tables as you mentioned.
Then I create two measures and here are their DAX codes.
Measure =
IF(
ISFILTERED('DateTable'[Month]),
CALCULATE(
SUM('SalesData'[SalesAmount]),
FILTER(
'DateTable',
'DateTable'[Month] = SELECTEDVALUE('DateTable'[Month])
)
),
CALCULATE(
SUM('SalesData'[SalesAmount]),
FILTER(
'DateTable',
'DateTable'[Month] = MONTH(TODAY()) - 1
)
)
)
Measure 2 = 'SalesData'[Measure] - 100
But as lbendlin said, you have to keep an option in Slicer or you won't be able to accomplish what you want to accomplish.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Your approach will fail because neither slicer is set to single select. You are allowing your users to select multiple months as well as multiple years, so "previous month" loses its meaning.
User | Count |
---|---|
12 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
19 | |
14 | |
8 | |
7 |