Forum Discussion

rk1904's avatar
rk1904
New Member
7 months ago
Solved

Use show items with no data with dynamic x-axis dates

Hello, I have a measure that depending on the date chosen in the slicer, will display the last 6 months up to that selected date. However, if the measure has no value for any of those months, the m...
  • cengizhanarslan's avatar
    7 months ago

     

    1. Keep Year-Month from Table Dates Aux on the X-axis

    2. Turn on Show items with no data for that axis field

    3. Add this measure and filter the visual to Flag = 1

    Axis - Last 6 Months Flag =
    VAR AnchorDate =
        MAX ( 'Table Dates'[Date] )          -- date selected in slicer (Table Dates)
    VAR EndMonth =
        EOMONTH ( AnchorDate, 0 )
    VAR ThisMonth =
        EOMONTH ( MAX ( 'Table Dates Aux'[Date] ), 0 )
    RETURN
    IF (
        ThisMonth <= EndMonth
            && ThisMonth > EOMONTH ( EndMonth, -6 ),
        1,
        0
    )

    Then:

    • Put Axis - Last 6 Months Flag into the Visual level filters

    • Set it to is 1

    • Keep Show items with no data = On