Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mape
Frequent Visitor

In a matrix, How I can replace the empty values in cells for the value in previous period?

Hi everyone!! I need help about this...

 

Measure of sales per year and in case there is no information for that year, show the sales of the previous year.

 

That is, given a series of sales per year for a series of customers, it would be necessary if, for a given year, that customer does not have a value, to fill the cell with the value of the last year that had value.

Example

Customer A (SALES 2017 = 1000, SALES 2016 = 1200, SALES 2015 = 900)

Client B (SALES 2016 = 500, SALES 2015 = 700)

 

In a matrix of sales of customer x year the crossing of Client B and 2017 would be empty and what I want is for it to take the value of the previous year that contains data, specifically 2016), that is to say that the table will remain as follows:

                 2015 2016 2017

Customer A 900 1200 1000

Client B 700 500 500

 

That value of 500 in 2017 I would have to put my measurement.

 

Thank you very much!!!!

 

 

2 REPLIES 2
Anonymous
Not applicable

Hi @mape,

 

If your blank records not actually exist in table, it is impossible to use if statement to find out it and replace it.
You need to create new table to add these missing records and combine with original records, then write measure on merged table to replace blank value to previous value.

 

BTW, it will be help if you provide some sample data.

 

Regards,

Xiaoxin Sheng

Greg_Deckler
Community Champion
Community Champion

In general, you would need an IF statement that checked if the value was BLANK() and if it is not, return the value, otherwise, return the PREVIOUSYEAR value.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (331)