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
Sankzpower
Helper I
Helper I

Filling gaps with a calculated measure

Hi guys

 

Hope my fellow power bi friends help me. I have a simple table sample which I could easily get it done in excel with the result what I need. However, I cannot seem to get it work in Power BI. Basically, I am filling the gaps and changing value in the value_missing column using a measure with the help of profile column. 

 

1st calculation = (Sum of all Value_missing column) multiply (row Profile value)

2nd Caculation = Sum(Profile column where value_missing is >0)

Final result = 1st Calculation/2nd Calculation

 

Sample file here in excel

 

MonthsProfileValue_MissingNew_Filled1st Calculation2nd CalculationFinal Result
Jan10%74575759979%757
Feb9%86068153979%681
Mar8%47560547979%605
Apr7% 53041979%530
May6%57845436079%454
Jun7%56949238979%492
Jul7%84550740179%507
Aug7%23551440779%514
Sep8% 56744979%567
Oct7%65456044379%560
Nov9%57465852179%658
Dec10%45776460579%764
3 REPLIES 3
AnthonyTilley
Solution Sage
Solution Sage

1st Calculation = 
Var Pr = Sum('Table'[Profile])
var T_VM = CALCULATE(sum('Table'[Value_Missing]),all('Table'))
Var f1 = T_VM * Pr

return f1

 

2nd Calculation = 
var T_VM = CALCULATE(sum('Table'[Profile]),ALL('Table'),'Table'[Value_Missing]>0)

return T_VM

 

Fianl Calculation = DIVIDE([1st Calculation],[2nd Calculation],0)

 

New_Filled = 
Var Pr = Sum('Table'[Profile])
var T_VM = CALCULATE(sum('Table'[Value_Missing]),all('Table'))
Var f1 = T_VM * Pr
var T_PR = CALCULATE(sum('Table'[Profile]),ALL('Table'),'Table'[Value_Missing]>0)
var ret = f1/T_PR
return ret

 

 

new filed.png





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks @AnthonyTilley 

 

I understand the logic behind that now. However, when I tried at my end its not coming up with the same result. I think its because I have got filters on as the one which I have attached is for one ID. I have multiple Ids with Jan - Dec records. I did try the below using your code but it would not work:

 

1st Calculation = 
Var Pr = Calculate(Sum('Table'[Profile]),all('Table'[IDs])
var T_VM = CALCULATE(sum('Table'[Value_Missing]),all('Table'[IDs]))
Var f1 = T_VM * Pr

return f1

 

Hi @Sankzpower ,

 

How about replacing ALL with ALLSELECTED? Can it work?

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.