Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Sathvik123
Helper V
Helper V

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 1
amitchandak
Super User
Super User

@Sathvik123 , if you simply want to change the measure you can consider field parameters

 

Power BI Field Parameters — A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...
Power BI Field Parameters- Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f

 

or refer this approch

https://medium.com/chandakamit/power-bi-when-i-felt-lazy-and-i-needed-too-many-measures-ed8de20d9f79

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.