Forum Discussion
Make the measures dynamic with date range selection.
- Anonymous2 years ago
Hi Anonymous
For your question, in your dax I see that you used "ALL" for filtering.
In fact, "ALL" removes the effect of the slicer. You can modify "ALL" to "ALLSELECTED".
"ALLSELECTED" retains the slicer filter and removes the other filters.
Your code should look like this:
InactiveClients_Beyond2Years = CALCULATE( COUNTROWS( FILTER( VALUES(SQL_Database_Website[NTID]), CALCULATE(MAX(SQL_Database_Website[SubmitDate])) <= MAX(SQL_Database_Website[SubmitDate]) - 730 ) ), ALLSELECTED(SQL_Database_Website[SubmitDate]) -- modify "ALL" to "ALLSELECTED" ) InactiveClients_Within2Years = CALCULATE( COUNTROWS( FILTER( VALUES(SQL_Database_Website[NTID]), CALCULATE(MAX(SQL_Database_Website[SubmitDate])) > MAX(SQL_Database_Website[SubmitDate]) - 730 && CALCULATE(MAX(SQL_Database_Website[SubmitDate])) <= MAX(SQL_Database_Website[SubmitDate]) ) ), ALLSELECTED(SQL_Database_Website[SubmitDate]) ) CrossServiceClients = CALCULATE( COUNTROWS( FILTER( VALUES(SQL_Database_Website[NTID]), CALCULATE(DISTINCTCOUNT(SQL_Database_Website[Type])) > 1 ) ), ALLSELECTED(SQL_Database_Website[SubmitDate]) )Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
For your question, in your dax I see that you used "ALL" for filtering.
In fact, "ALL" removes the effect of the slicer. You can modify "ALL" to "ALLSELECTED".
"ALLSELECTED" retains the slicer filter and removes the other filters.
Your code should look like this:
InactiveClients_Beyond2Years =
CALCULATE(
COUNTROWS(
FILTER(
VALUES(SQL_Database_Website[NTID]),
CALCULATE(MAX(SQL_Database_Website[SubmitDate])) <= MAX(SQL_Database_Website[SubmitDate]) - 730
)
),
ALLSELECTED(SQL_Database_Website[SubmitDate]) -- modify "ALL" to "ALLSELECTED"
)
InactiveClients_Within2Years =
CALCULATE(
COUNTROWS(
FILTER(
VALUES(SQL_Database_Website[NTID]),
CALCULATE(MAX(SQL_Database_Website[SubmitDate])) > MAX(SQL_Database_Website[SubmitDate]) - 730 &&
CALCULATE(MAX(SQL_Database_Website[SubmitDate])) <= MAX(SQL_Database_Website[SubmitDate])
)
),
ALLSELECTED(SQL_Database_Website[SubmitDate])
)
CrossServiceClients =
CALCULATE(
COUNTROWS(
FILTER(
VALUES(SQL_Database_Website[NTID]),
CALCULATE(DISTINCTCOUNT(SQL_Database_Website[Type])) > 1
)
),
ALLSELECTED(SQL_Database_Website[SubmitDate])
)
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks a lot, it worked now and it's dynmaic
I really appreciate your help