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! Request now

Reply
Anonymous
Not applicable

Trouble Aggregating based on condition

Hello,

 

I am new to power bi/power query and only have real experience in excel pivot tables.

 

I am trying to aggregate cargo volume that has been delivered "In Time" of its SLA limits and divide it by the total volume delivered.

 

First, I found the elapsed time between shipping date and received date and formatted it in whole numbers expressed as hours. Then I merged queries using a left join aggregate with another table that contained the corresponding SLA hours to the goods. As far as I can tell it successfully added a SLA hours column corresponding to the good being shipped.

 

Then, I added a conditional column stating that IF([Elapsed Hours] < [SLA Hours],  [Volume weight],0). This column would be expected to show a weight if the good was delivered on time or a 0 if the good was not delivered on time. 

 

When I summarize in Power BI I get a total volume number that is close to being correct (off by a few lbs), and a "Weigh In Time" that is completely wrong.

 

I've tried using a measure instead of adding a column, IF statements rather than adding columns but nothing wants to match the same results in excel pivot tables. I am not sure if I am using the conditional column function correctly, if I am merging the queries correctly.

 

Any help is appreciated!

 

Thanks 

1 REPLY 1
kentyler
Solution Sage
Solution Sage

Can you make a sample power bi file available ? That would help debug your problem.





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


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