Forum Discussion

manoj_0911's avatar
manoj_0911
Kudo Commander
1 year ago
Solved

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.
  • 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.

     

     

     

     



    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
    )

     

     

1 Reply

  • 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.

     

     

     

     



    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
    )