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.
I have a set of data registrations for several months => (value_reported) for every (yyyymm). Yet, for some months there has'nt been any registration. I would like to/need to fill out all the 'gaps' in my matrix with either the next available or the previous available value. So I would need to create a new columns/measure replacing every blank with either the former or the folowwing value (one of both will do). The 'snip' is from the 'matrix' visual.
Can anybody tell me what formula would return one of the expected values?
Solved! Go to Solution.
Hi @BieBel, you need to create a measure with the following logic:
Measure Value Adjusted =
VAR _Value = [Measure Value] //value of a measure you're interested in
VAR _yyyymm = SELECTEDVALUE( CalendarTable[yyyymm] ) //currently selected yymmmm
VAR _yyyymm_Previous = //find prevoius _yyyymm
MAXX(
CALCULATETABLE(
SELECTEDVALUE( CalendarTable[yyyymm] ),
CalendarTable[mmyyyy] < _yyyymm
),
[yyyymm]
)
RETURN
IF(
_Value <> BLANK(),
_Value,
CALCULATE(
[Measure Value],
CalendarTable[mmyyyy] = _yyyymm_Previous
)
)
I hope it helps! Good luck with your project 🙂
Hi @BieBel ,
Did Sergii24 reply solve your problem? If so, please mark it as the correct solution, and point out if the problem persis
Best regards,
Adamk Kong
Hi @BieBel, you need to create a measure with the following logic:
Measure Value Adjusted =
VAR _Value = [Measure Value] //value of a measure you're interested in
VAR _yyyymm = SELECTEDVALUE( CalendarTable[yyyymm] ) //currently selected yymmmm
VAR _yyyymm_Previous = //find prevoius _yyyymm
MAXX(
CALCULATETABLE(
SELECTEDVALUE( CalendarTable[yyyymm] ),
CalendarTable[mmyyyy] < _yyyymm
),
[yyyymm]
)
RETURN
IF(
_Value <> BLANK(),
_Value,
CALCULATE(
[Measure Value],
CalendarTable[mmyyyy] = _yyyymm_Previous
)
)
I hope it helps! Good luck with your project 🙂
Hello,
To fill in the gaps in your matrix with either the next available or previous available value, you can use a DAX measure that implements the COALESCE function along with the LOOKUPVALUE function. Here's a step-by-step solution:
This measure does the following:
To use this measure:
This solution will fill in all gaps with either the next or previous available value, prioritizing the next available value if both exist.
Remember to adjust the field names ([value_reported], [Date Column], etc.) to match your actual column names in the dataset.
This approach is flexible and will work even if there are multiple consecutive blank months, as it will keep looking forward or backward until it finds a non-blank value.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
123 | |
79 | |
49 | |
38 | |
37 |
User | Count |
---|---|
196 | |
80 | |
70 | |
51 | |
42 |