Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
I am trying to pull the latest data (updated monthly) by calculating the MAX date where the "Actual" column is not blank. However, the issue arises when the latest data is equal to 0. PowerBI reads the latest data as the last row that does not contain 0. The following screenshot shows data through December 2023, with December = 0%.
The current DAX formula:
Solved! Go to Solution.
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.
Proud to be a Super User!
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.
Proud to be a Super User!
This worked perfectly! Thank you so much! This was a huge help!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
144 | |
72 | |
63 | |
52 | |
49 |
User | Count |
---|---|
208 | |
91 | |
62 | |
59 | |
57 |