Forum Discussion
Displaying latest data when data is equal to 0.
- 2 years ago
To address the issue where the latest data is equal to 0 and you want to consider it as the latest data instead of skipping it, you can modify your DAX formula to include zeros as well. The issue with your current formula is that it's using `SELECTEDVALUE` which will not consider a row with a 0 value as it is treated the same as BLANK by the filter `Actual <> BLANK()`.
Here's a revised version of the DAX formula that includes the 0 values as well:
Comm_Actual =
VAR MaxDateWithActual =
CALCULATE(MAX('Communications Append'[Date]), NOT(ISBLANK('Communications Append'[Actual])))
VAR RecentActual =
CALCULATE(SELECTEDVALUE('Communications Append'[Actual]), 'Communications Append'[Date] = MaxDateWithActual)
RETURN
IF(ISBLANK(RecentActual), 0, RecentActual)In this version, `MaxDateWithActual` calculates the maximum date where the `Actual` column has any value, including 0. Then `RecentActual` gets the `Actual` value for that date. Finally, if `RecentActual` is BLANK (which shouldn't happen unless there's no data at all), it returns 0, otherwise, it returns the `Actual` value found.
Remember to replace `'Communications Append'` with the actual name of your table if it's different. This formula should work assuming that a 0 value is actually stored in the data and not just displayed as 0% while the underlying data is blank or null.
To address the issue where the latest data is equal to 0 and you want to consider it as the latest data instead of skipping it, you can modify your DAX formula to include zeros as well. The issue with your current formula is that it's using `SELECTEDVALUE` which will not consider a row with a 0 value as it is treated the same as BLANK by the filter `Actual <> BLANK()`.
Here's a revised version of the DAX formula that includes the 0 values as well:
Comm_Actual =
VAR MaxDateWithActual =
CALCULATE(MAX('Communications Append'[Date]), NOT(ISBLANK('Communications Append'[Actual])))
VAR RecentActual =
CALCULATE(SELECTEDVALUE('Communications Append'[Actual]), 'Communications Append'[Date] = MaxDateWithActual)
RETURN
IF(ISBLANK(RecentActual), 0, RecentActual)
In this version, `MaxDateWithActual` calculates the maximum date where the `Actual` column has any value, including 0. Then `RecentActual` gets the `Actual` value for that date. Finally, if `RecentActual` is BLANK (which shouldn't happen unless there's no data at all), it returns 0, otherwise, it returns the `Actual` value found.
Remember to replace `'Communications Append'` with the actual name of your table if it's different. This formula should work assuming that a 0 value is actually stored in the data and not just displayed as 0% while the underlying data is blank or null.
- 081520232 years agoFrequent Visitor
This worked perfectly! Thank you so much! This was a huge help!