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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
sajal161292
Helper V
Helper V

filling blanks with previous row in matrix visual

Hi,

 

I have a report as shown below.

 

powerbi7.PNG

 

As shown there is no data from 2018-01 till 2018-11 for second hieracrchy.

In case of any blank,I want to replace it with the data in previous row and extend it till last week so that there is no blank row and there exists data across every week

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@sajal161292,


I make a test in the following sample table.
1.JPG

First, add a conditional column in the table.

NewValue = IF(ISBLANK(Table[Value]), CALCULATE(FIRSTNONBLANK(Table[Value],Table[Value]),FILTER(Table,Table[Custom]=EARLIER(Table[Custom]) && Table[Week]=EARLIER(Table[Week]))),Table[Value])


Second, create a new columns using DAX below.
2.JPG

Third, create Matrix visual as below.
3.JPG

Regards,
Lydia

View solution in original post

11 REPLIES 11
Anonymous
Not applicable

@sajal161292,


I make a test in the following sample table.
1.JPG

First, add a conditional column in the table.

NewValue = IF(ISBLANK(Table[Value]), CALCULATE(FIRSTNONBLANK(Table[Value],Table[Value]),FILTER(Table,Table[Custom]=EARLIER(Table[Custom]) && Table[Week]=EARLIER(Table[Week]))),Table[Value])


Second, create a new columns using DAX below.
2.JPG

Third, create Matrix visual as below.
3.JPG

Regards,
Lydia

Hi,

 

It is not working correctly for me.

 

I think you have got confused with the requirement.

Purpose is to fill the weeks having no data as showin in the screenshots with the data of previous week and roll it up across the weeks till there is data for the week.

 

So can you please suggest an alternative?

Anonymous
Not applicable

@sajal161292,

Please share sample data of your original table.

Regards,
Lydia

Hi,

 

Please find the sample file in the link below:

 

https://drive.google.com/open?id=1Yxc6EX0f7pRoAK_HmlDUwjgS9v37r2LM

 

 

Anonymous
Not applicable

@sajal161292,

In your sample data, I note that you don't have rows in some weeks for specific items, in this case, I am afraid that it is not possible to fill blanks with previous row in Matrix visual.

Regards,
Lydia

Hi,

 

I need to implement it urgently in one of my report.

Is there any alternative approach to achieve this?

Anonymous
Not applicable

@sajal161292,

You can add rows for these items which have blank values in these weeks(2018-01, 2018-02.....),  then create the DAX I provide in your table. And the  sample table has been provided in my first reply.

Regards,
Lydia

Hi,

 

How can i add blank rows in matrix visual in power BI.

Or do i need to add blank rows in SQL query?

Anonymous
Not applicable

@sajal161292,

You would need to add these rows in your original data source but not in Martix.

Regards,

Lydia

 

Hi,

 

When i have to add blank rows in my SQL query i need to hardcode the quantity for a particular date right?

Anonymous
Not applicable

@sajal161292,

Yes. Add null values for quantity, for more details, please see the Value column in my first reply.

Regards,
Lydia

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors