Forum Discussion
rk1904
7 months agoNew Member
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...
- 7 months ago
Keep Year-Month from Table Dates Aux on the X-axis
Turn on Show items with no data for that axis field
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
danextian
7 months agoSuper User
hi rk1904
Use a disconnected dates table for the date selection and create this measure:
NÂș App =
VAR DateActual =
CALCULATE (
MAX ( 'DisconnectedDates'[Date] ),
ALLSELECTED ( DisconnectedDates )
)
VAR MinDate =
EDATE ( DateActual, -6 )
VAR CurrentDate =
MAX ( 'Table Dates'[Date] )
RETURN
IF (
CurrentDate > MinDate && CurrentDate <= DateActual,
SUM ( 'Data'[Value] ) + 0
)
The flat lines in the gif below are dates with no data.
Please see the attached pbix.