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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
SammiElPadre
Frequent Visitor

Date Dimension change based on slicer selection

Hi Folks,

I think i can't be the first one to encounter this problem.

 

I've got a report, usually based on months, so my x-axis of most visuals is something like 01-22 02-22 etc.

So now if my user selects a single month out of my column Monthname via slicer, all visuals will show a single bar, point and so on.

 

So, I want to change the x-axis day-based.

For this, I worte two measures:

First, I get the destinct count of my Months for the slicer. If theres only one monthname, count will be one, if there is more than one monthname, it will be another number.

 

Anzahl Monate = Distinctcount(KALENDER[Monatsname])
After that, I wrote another measure, which is a switch-statement based on what number my first measure gives back:

Datumsswitch =
       var selectedmonth = [Anzahl Monate]

    return
        SWITCH(selectedmonth, 1, SELECTEDVALUE(Kalender[Datum]),"Fehler Datum",
           12,Selectedvalue(KALENDER[Eindeutiger Monat], "Fehler Monat"),
            "Mehrfachauswahl")
So, basically, what I'm trying to do is: If the count of monthnames is one, select the Date-Coloumn, if its 12, select the Month-Coloumn, if its anything else give back "Multiple selections"
 
It works pretty fine with the defaults, but it's not giving back any of my dates.
 
I know I made a mistake somwhere on the way, but I don't get the clue where I made it. Could you please give me a hind?
 
Kind regards
Sammi
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@SammiElPadre , If you need a dynamic axis based on selected values, I doubt that is possible as of now.

 

You can give a slicer using 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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@SammiElPadre , If you need a dynamic axis based on selected values, I doubt that is possible as of now.

 

You can give a slicer using 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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Ok, thank you. 

 

BAd news, but then it has to be manual.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.