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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
dam0853
Frequent Visitor

Dynamic subtraction based on selection of records

I'm wondering if this is possible in PowerBI. I've attached a screenshot of the data.

 

As users multiselect data in a table, can PowerBI dynamically calculate what the score will be. 

 

For example, if they select the first two items in the list (yellow rows), can PowerBI dynamically calculate that ScoreAfterGroup should be 752?

 

imgmd.PNG


Thanks,

MD

 

 

1 ACCEPTED SOLUTION

@dam0853 try this, make sure to change table name and column name as per your data model.

 

Score After = MAX( Table3[Score] ) - SUM( Table3[Reduce] )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

6 REPLIES 6
dcampbell321
New Member

You can  do this dynamically using a simple Measure that would serve as both your ScoreAfter in an unsummarized Table and your ScoreAfterGroup as a Card with a Sum aggregation.  Measures are great because they respond to your selection, but there are limitations. See Measure below:

ScoreAfter = AVERAGE(Sheet1[Score]) - SUM(Sheet1[Reduce])

Not sure if this is what you are looking for, more information about the "dynamic" selection and whether the groups have a common criteria  unifying them.  You wouldn't be able to display it dynamically as you are showing in your image as far as I am aware.

@dcampbell321 that didn't seem to work. I used to use the FIXED option in Tableau to provide some type of LOD calc for this based on the ID, but I am at a loss in PowerBI

@dam0853 try this, make sure to change table name and column name as per your data model.

 

Score After = MAX( Table3[Score] ) - SUM( Table3[Reduce] )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@dam0853 so your calulation look like is this

 

for yellow: 820 - (54+14) = 752

for blue   : 820 - (14+14+12) = 780

 

Correct?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k Correct, but I want it to be dynamic, so if I were to select only the first records in the colored sets, it would look like:

 

820-54(first record from yellow dataset)-14(first record from blue dataset) = 752.

 

Make sense?

@dam0853 sure the solution provided by @dcampbell321   will work, only issue it will average out the score if selection is made from two different set of scores. Based on your model that is the best option, or you can use MAX instead of AVERAGE



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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