I have a page in my Power BI report with multiple charts having a timeline on the x axis. I would like to be able to switch the timeline between the following (Day, Month, Quarter, Year)
using a slicer.
For example when I select Month on the slicer
, all the charts timeline should change to months and the same should happen if I select Day or Quarter etc.
slicer and charts Month selected
slicer and charts Quarter selected
I have a Date Table which has a column for Day, Month, Quarter, Year
and a 1 to many relationship
exists between this table and the other tables.
Is there a way to achieve this in Power BI?
I have tried creating a measure that switches between the columns in the date table based on slicer selection but not sure I have done the right thing.
When I try to add the measure to the chart date it doesn't accept it.
Period Selection =
var selectitem=IF(HASONEVALUE('Period_Table'[Periods]),
VALUES
(Period_Table[Periods]),BLANK())
return
SWITCH(selectitem,"Day",MAX('Date Table'[Date]),
"Month",MAX('Date Table'[Month of Year]),
"Quater",MAX('Date Table'[Quater of Year]),
"Year",MAX('Date Table'[Year]),BLANK())
Note Period_Table
is for the slicer and contains a column called Periods
with the values (Day, Month, Quarter, Year)