Forum Discussion
Measure to display Project IDs based on data in 2 columns.
- 3 years ago
The below should limit the measure to only show values when there are 3 entries,
Red for 3 months = VAR StartDate = EOMONTH ( TODAY (), -4 ) + 1 VAR EndDate = EOMONTH ( TODAY (), -1 ) VAR Statuses = CALCULATETABLE ( VALUES ( 'Table'[Overall status] ), DATESBETWEEN ( 'Table'[Reporting date], StartDate, EndDate ) ) VAR NumDates = COUNTROWS ( CALCULATETABLE ( VALUES ( 'Table'[Reporting date] ), DATESBETWEEN ( 'Table'[Reporting date], StartDate, EndDate ) ) ) RETURN IF ( COUNTROWS ( Statuses ) = 1 && "Red" IN Statuses && NumDates = 3, 1 )I'm not sure what you mean in your second question. A DAX calculation can use as many columns as it needs to.
- 3 years ago
That measure is returning a table of values, so it needs to be used where a table is expected rather than a scalar value. If you are trying to exclude older data from your table visual you could create a measure like
Reporting Dates is in last 3 Months = VAR StartDate = EOMONTH ( TODAY (), -4 ) + 1 VAR EndDate = EOMONTH ( TODAY (), -1 ) RETURN IF ( SELECTEDVALUE ( 'Table'[Reporting date] ) IN DATESBETWEEN ( 'Table'[Reporting date], StartDate, EndDate ), 1 )and then use that as a visual level filter to only show where the value is 1.
- 3 years ago
Hi John,
Just to add to this, restricting data to show for the latest 3 months only for which we were comparing data for.
Found this setting in the visual level filter to dynamically show only the last 3 months of data.So, no need for a separate measure and this actually makes the visual load faster as well.
Just adding it here for others to refer in future.
Thanks !!
That measure is returning a table of values, so it needs to be used where a table is expected rather than a scalar value. If you are trying to exclude older data from your table visual you could create a measure like
Reporting Dates is in last 3 Months =
VAR StartDate =
EOMONTH ( TODAY (), -4 ) + 1
VAR EndDate =
EOMONTH ( TODAY (), -1 )
RETURN
IF (
SELECTEDVALUE ( 'Table'[Reporting date] )
IN DATESBETWEEN ( 'Table'[Reporting date], StartDate, EndDate ),
1
)
and then use that as a visual level filter to only show where the value is 1.
Hi John,
Just to add to this, restricting data to show for the latest 3 months only for which we were comparing data for.
Found this setting in the visual level filter to dynamically show only the last 3 months of data.
So, no need for a separate measure and this actually makes the visual load faster as well.
Just adding it here for others to refer in future.
Thanks !!