Forum Discussion
Setting a default value in a slicer
- 4 years ago
Hi Syndicate_Admin ,
Maybe you can try the function ISFILTERED().
IF no selection, then get MONTH of TODAY() and use CALCULATE() to sum the value of this month.
You can refer the following expression:
Total = VAR _today = TODAY() VAR _Defult = CALCULATE( SUM( 'DATE'[Value] ), FILTER( ALL( 'DATE' ), MONTH( [DATE] ) = MONTH( TODAY() ) ) ) RETURN IF( ISFILTERED( 'DATE'[Month] ), SUM( 'DATE'[Value] ), _Defult )The result:
I put the pbix file in the end you can refer.
Best RegardsCommunity Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hello thanks, I tell you a little that the date table I get from the following query
Sorry for not being clear - the formula I gave is M (not DAX) so you need to click Transform Data to add this in Power Query. Since your Date table uses DAX, you will need to create the Date table in Power Query to use this method: https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html
Alternative option is to use DAX to create the column, but it's less efficient.
New Column =
VAR _CurrentMonth = MONTH(TODAY())
RETURN
IF( _CurrentMonth = Date[Month], "Current", Date[Month])