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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
veronika_prexl
New Member

How to create a Measure that fills the empty cells with the previous value

I need to compare Column A with Column B.

I want to fill the empty cells with the previous value.

 

Date               A               B

1.1.              1021          913

2.1.                                  1201

3.1.              1381

4.1.              1669         1525

 

 

Date               A               B

1.1.              1021          913

2.1.              1021        1201

3.1.              1381        1201

4.1.              1669         1525

 

Thank you!

Regards!

 

Veronika

2 REPLIES 2
harshnathani
Community Champion
Community Champion

Hi @veronika_prexl ,

 

You can use the fill down feature in Power Query.

 

https://www.youtube.com/watch?v=vQIDJVkFW8o

https://www.youtube.com/watch?v=xRDRwnfv1uE

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

 

az38
Community Champion
Community Champion

Hi @veronika_prexl 

you need to create 2 new measures

Anew = 
var _prevDate = CALCULATE(MAX('Table'[Date]);FILTER(ALL('Table');'Table'[Date]<SELECTEDVALUE('Table'[Date])&& NOT(ISBLANK('Table'[A]))))

RETURN

IF(ISBLANK(SELECTEDVALUE('Table'[A]));LOOKUPVALUE('Table'[A];'Table'[Date];_prevDate);SELECTEDVALUE('Table'[A]))

and the same for B

Bnew = 
var _prevDate = CALCULATE(MAX('Table'[Date]);FILTER(ALL('Table');'Table'[Date]<SELECTEDVALUE('Table'[Date])&& NOT(ISBLANK('Table'[B]))))

RETURN

IF(ISBLANK(SELECTEDVALUE('Table'[B]));LOOKUPVALUE('Table'[B];'Table'[Date];_prevDate);SELECTEDVALUE('Table'[B]))

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors