Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Swapping columns based on slicer values

Hello All,

I have a ticket table having date like below daily wise.

 

My requirement is I need to show a slicer which have values like daily,weekly,monthly.

If the user selects daily I need to show daily data

If the user selects Monthly I need to show monthly data.(Here I need to aggrigate data for monthly)

If the user selects Weekly I need to show weekly data. (Here I need to aggrigate data for Weekly)

 

So I created a table in power bi with these values and showing as slicer.

and I wrote dax for weekly and monthly like below.

 

Monthly view Column: 

Month Test = STARTOFMONTH('Tickets'[containment.Date])

 

Weekly view Column: 

Week Test = 'Tickets'[containment.Date]+1-WEEKDAY('Tickets'[containment.Date]-7)

 

Daily view Column:

Daily Test ='Tickets'[containment.Date]-

 

Now I created a dax column like below change columns based on slicer selection but its not working.

Trend date = if(max(TrendType[TrendType])="Monthly",'Tickets'[Month Test],'Tickets'[Week Test])
 
Could any one please help on dax calc

 

 

1 Reply