Forum Discussion
Filter by values with TRUE() to visualize
- Anonymous5 years ago
Hi Anonymous
I build a sample to have a test.
My sample table is as below, year/month/qtr columns are calculated columns.
Year = YEAR(Sheet9[Date])Month = MONTH(Sheet9[Date])Qtr = QUARTER(Sheet9[Date])Date Table:
Date = CALENDARAUTO()Select Table:
We can build a date before slicer by Date table, and a select slicer by Select Table.
Measure:
Sum of value = SUM(Sheet9[Value])Measure = VAR _SelectStatus = SELECTEDVALUE('Select'[Select]) VAR _SelectDate = MAX('Date'[Date]) Return IF( ISFILTERED('Select'[Select]), SWITCH( TRUE(), _SelectStatus="CurrentDay",IF(MAX(Sheet9[Date])=_SelectDate,1,0), _SelectStatus="CurrentMonth",IF(MAX(Sheet9[Year]) = YEAR(_SelectDate)&&MAX(Sheet9[Month])=MONTH(_SelectDate),1,0), _SelectStatus="CurrentQuarter",IF(MAX(Sheet9[Year]) = YEAR(_SelectDate)&&MAX(Sheet9[Qtr])=QUARTER(_SelectDate),1,0) ) )Build a Table visual by Sheet9[Date], Sheet9[Value] and Sum of value measure.
Then we add Measure into the filter field in this table visual and set it to show items when value =1.
Result is as below.
Select "CurrentDay", Date = 2020/01/23
Select "CurrentMonth", Date = 2020/01/23
Select "CurrentQuarter", Date = 2020/01/23
You can download the pbix file from this link: Filter by values with TRUE() to visualize
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
I build a sample to have a test.
My sample table is as below, year/month/qtr columns are calculated columns.
Year = YEAR(Sheet9[Date])Month = MONTH(Sheet9[Date])Qtr = QUARTER(Sheet9[Date])
Date Table:
Date = CALENDARAUTO()
Select Table:
We can build a date before slicer by Date table, and a select slicer by Select Table.
Measure:
Sum of value = SUM(Sheet9[Value])Measure =
VAR _SelectStatus =
SELECTEDVALUE('Select'[Select])
VAR _SelectDate =
MAX('Date'[Date])
Return
IF(
ISFILTERED('Select'[Select]),
SWITCH(
TRUE(),
_SelectStatus="CurrentDay",IF(MAX(Sheet9[Date])=_SelectDate,1,0),
_SelectStatus="CurrentMonth",IF(MAX(Sheet9[Year]) = YEAR(_SelectDate)&&MAX(Sheet9[Month])=MONTH(_SelectDate),1,0),
_SelectStatus="CurrentQuarter",IF(MAX(Sheet9[Year]) = YEAR(_SelectDate)&&MAX(Sheet9[Qtr])=QUARTER(_SelectDate),1,0)
)
)
Build a Table visual by Sheet9[Date], Sheet9[Value] and Sum of value measure.
Then we add Measure into the filter field in this table visual and set it to show items when value =1.
Result is as below.
Select "CurrentDay", Date = 2020/01/23
Select "CurrentMonth", Date = 2020/01/23
Select "CurrentQuarter", Date = 2020/01/23
You can download the pbix file from this link: Filter by values with TRUE() to visualize
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous5 years agoNot applicable
Thank you for taking the time to help. Now I see what I was doing wrong