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

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

Reply
questions
Helper I
Helper I

Summarize by max over multiple line and sum the value

I want to cacluate the % of qty submitted out of total qty.

I have multipule line for bill no. 1 in my dataset due to data issue. However, whenever there are date appear in any line, I will consider bill no. 1 as submitted.  Thus, my expected result is 200/300 = 66.7% but now in the measure I made, it is showing 150/300 = 50%. Can anyone have any clue how the measure should be written?

 

Bill no.Submitted Dateqty
11/12/201950
1 30
1 20
23/12/2019100
3 100
2 ACCEPTED SOLUTIONS
v-kelly-msft
Community Support
Community Support

Hi @questions

 

You need a measure as below:

 

Measure = 
var a =IF(MAX('Table'[Submitted Date])<>BLANK()&&MAX('Table'[Index])<>1,CALCULATE(SUM('Table'[qty]),FILTER(ALL('Table'),'Table'[Index]<=SELECTEDVALUE('Table'[Index]))),BLANK())
var b = SUMX(ALL('Table'),'Table'[qty])
Return
a/b

 

 

Finally you will see:

 

Annotation 2020-04-03 103357.png

 

For the related .pbix file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

View solution in original post

Thanks!! it works but i just finetuning a bit so it works out...Here it is in case other users need this information.

 

measure =
var _tab = summarize(Table[Bill No], "_Date",firstnonbank(table[Submitted Date],0),"_qty",sum(table[Qty])
)
return
divide(sumx(_tab,if(not(isblank([_Date])),[_qty],0),sumx(_tab,[_qty]))

View solution in original post

4 REPLIES 4
v-kelly-msft
Community Support
Community Support

Hi @questions

 

You need a measure as below:

 

Measure = 
var a =IF(MAX('Table'[Submitted Date])<>BLANK()&&MAX('Table'[Index])<>1,CALCULATE(SUM('Table'[qty]),FILTER(ALL('Table'),'Table'[Index]<=SELECTEDVALUE('Table'[Index]))),BLANK())
var b = SUMX(ALL('Table'),'Table'[qty])
Return
a/b

 

 

Finally you will see:

 

Annotation 2020-04-03 103357.png

 

For the related .pbix file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

amitchandak
Super User
Super User

@questions ,

Try like

measure =
var _tab = summarize(Table[Bill No], "_Date",firstnonbank(table[Submitted Date]),"_qty",sum(table[Qty])
)
return
divide(sumx(_tab,if(not(isblank[_Date])),[_qty],0),sumx(_tab,[_qty]))
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks!! it works but i just finetuning a bit so it works out...Here it is in case other users need this information.

 

measure =
var _tab = summarize(Table[Bill No], "_Date",firstnonbank(table[Submitted Date],0),"_qty",sum(table[Qty])
)
return
divide(sumx(_tab,if(not(isblank([_Date])),[_qty],0),sumx(_tab,[_qty]))

Hi @questions ,

 

Good job,so is your issue solved?Can you mark the reply as answered to close it?

 

Much appreciated.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

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.