Forum Discussion
Fill out empty rows with data from other colums
- 2 years ago
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:
- First, create a calculated column in your date table (if you don't have one, create a continuous date table) to represent each month:
- Then, create a measure that will fill in the blanks with either the next or previous non-blank value:
This measure does the following:
- It first checks if there's a value for the current cell.
- If there is, it returns that value.
- If not, it uses COALESCE to return the first non-blank value from: a. The next available future value (using LOOKUPVALUE and MINX) b. The most recent past value (using LOOKUPVALUE and MAXX)
To use this measure:
- Add it to your matrix visual.
- Make sure your matrix is using the date column you created in step 1 for the columns.
- Use the fa_dp_jp field for the rows.
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.