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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply

Reducing quantity of tickets based on tickets sold

Alright, I can't seem to wrap my head around solving this one so hopefully someone out there can help.

 

I have groups of tickets in multiple sections.

Color Group# of seatsSection
Tan6300
Tan20301
Tan20302
Purple15201
Purple15202

 

Then I also have people buying tickets

Receipt #Color GroupAmount of tickets
1Tan5
2Tan4
3Purple2

 

I'm trying to figure out how to calculate a running total of remaining tickets and whether or not each receipt can sit together (they have to be able to sit together). So for example Receipt #1 has bought 5 of the 6 tickets in section 300 so I need to reduce 300 to 1 remaining ticket so when I'm assigning Receipt 2 I'll know I don't have enough tickets remaining to sit them in 300 so they'll need to go to 301 and then reduce 301 by 4 tickets. I hope that makes sense!

1 REPLY 1
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @davidgaribaldi 

 

this issue of yours requires looping, doesn't it? That is pretty tricky in DAX, but it is doable. Here is how loops can be implemented: https://community.powerbi.com/t5/Community-Blog/For-and-While-Loops-in-DAX/ba-p/636314

 

Cheers,
Sturla

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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