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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.