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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
manoj_0911
Post Patron
Post Patron

Dynamic Date Axis

Dynamic Date Axis:

 

I need a date axis in my visuals that dynamically adjusts based on the selected date range, with specific behavior as follows:

  • If "Today" or "Yesterday" is selected, the axis should display Hour.
  • If "This Week" or "Last Week" is selected, the axis should display Date.
  • If "This Month" or "Last Month" is selected, the axis should display Week.
  • If "This Quarter" or "Last Quarter" is selected, the axis should display Month.
  • If "This Year" or "Last Year" is selected, the axis should display Month.
  • If a "Custom Range" is selected, the axis should:
    • Display Month if the selection is greater than 30 days.
    • Display Week if the selection is less than 30 days.
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I tried to create a test version like below.
It is quite difficult to step further in your semantic model because I do not have good understanding of the logic of the business requirement of the analysis.
I hope you can start from here to implement correctly.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1727072183574.png

 

 

 

Jihwan_Kim_0-1727072152018.png



parameter selection measure: = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 1, 2 }
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 0, 1,
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 3, 4 }
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 1, 1,
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 5, 6 }
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 2, 1,
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 7, 8 }
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 3, 1,
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 9, 10 }
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 4, 1,
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 11 }
            && COUNTROWS ( 'Date' ) >= 30
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 3, 1,
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 11 }
            && COUNTROWS ( 'Date' ) < 30
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 2, 1
)

 

Jihwan_Kim_2-1727072225749.png

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

I tried to create a test version like below.
It is quite difficult to step further in your semantic model because I do not have good understanding of the logic of the business requirement of the analysis.
I hope you can start from here to implement correctly.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1727072183574.png

 

 

 

Jihwan_Kim_0-1727072152018.png



parameter selection measure: = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 1, 2 }
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 0, 1,
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 3, 4 }
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 1, 1,
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 5, 6 }
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 2, 1,
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 7, 8 }
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 3, 1,
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 9, 10 }
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 4, 1,
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 11 }
            && COUNTROWS ( 'Date' ) >= 30
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 3, 1,
    SELECTEDVALUE ( DatePeriods[Sort] )
        IN { 11 }
            && COUNTROWS ( 'Date' ) < 30
            && SELECTEDVALUE ( parameter_hour_day_week_month[sort] ) = 2, 1
)

 

Jihwan_Kim_2-1727072225749.png

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors