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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Running Sum # and Running Sum % based on status Power BI (DAX)

Hi,

I am struggling with creating Running Summ for value based on two statuses I have in my table. The problem is that I do not have dates, only text and numeric values (I created rank index as a help column). Please have a look at my data and screen below.

 

I need to calculate Running Sum for Column Distribution but for status "Gains" and "Gross" separately. So the Running Sum should be calculated for "Gains" and then starts again for "Gross".

Then I need to use that to create Percent of Total - also separately for "Gains" only and for "Gross" only... and then I need this Percent of Total again in another column in a Cumulative way for both Gains and Gross. This is very hard to do in DAX.

 

Can you please help me?? 

 

- I need to calculate: 

 

1. Running Sum (for distribution)

2. Percent of total separately for Gains and Gross (for distribution)

3. Cumulative Percentage separated for Gains and for Gross (for percentage calculated for distribution):

 

example.JPG

 

Is this possible to calculate via DAX? Can you help me as I am struggling with this for a long time and cannot find any answer neither on this Community formum nor anywere else.

 

Thank you!

Pawel

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous I added a status sort column in the power query, I think the value is 1 and 2 and then I sorted the Status column by this new Status sort column.

 

Since I cannot make changes in PQ in your new file, just add a Status Sort column from the original file I sent to you and sort the Status column by this new column. Good luck!

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



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
parry2k
Super User
Super User

@Anonymous I added a status sort column in the power query, I think the value is 1 and 2 and then I sorted the Status column by this new Status sort column.

 

Since I cannot make changes in PQ in your new file, just add a Status Sort column from the original file I sent to you and sort the Status column by this new column. Good luck!

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



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.

Anonymous
Not applicable

It worked, solved the sorting problem!

Thank you very much.

 

Regards

Pawel

 

parry2k
Super User
Super User

@Anonymous solution attached, tweak it as per your needs.

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



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

@Anonymous yes, it is possible, share the sample pbix file, and will get back to you with the solution.



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.

Anonymous
Not applicable

Hi,

Thank you very much for enclosed Power BI. All measures looks great, and they calculate as they should. However, I think I am still struggling with sorting problem. The sorting is key thing when it comes to Running Sum. Somehow my Index does not sort the way it does in your example.

 

Maybe this is because of the data set based on excel file? I followed all your instructions and get different output. Can you have a look at enclosed file? This is what I get:

 

https://1drv.ms/u/s!AtEHWSVFE9URi1k6vdb9LHZaSMiA?e=U1W748

 

As you can see Index does not sort as I need. What do I do wrong?

 

screen1.JPG

 

The whole Idea is to use both Statuses, and use Filter so I can see results either for Gains, or for Gross. Never for both in the same time. So when I use filter, index works fine, but calculations are still calculating whole column, not only selected status. 

 

I  even created status sort columns as You did (but you are did not use it anywhere). Can you please help me with the enclosed file?

 

Thank you in advance!

Pawel

Anonymous
Not applicable

Hi,

Thank you so much. I created an excel plus Power BI example. As I am new on this Community forum, I cannot enclose pbix files. I will share it via OneDrive, can you check this link?

 

https://1drv.ms/u/s!AtEHWSVFE9URi1dzhQ_h2MwQw5_D?e=gffwoA

 

Hope this works, please let me know. 

 

I keep there two index columns. One is only for sorting purpose as for some reason Power BI do not want to sort my Score Range in a visualisation the way I would expect (100-125 is first, 1-100 as second...). Second General Index I was trying to use for Running Sum purpose.. without the success 😞

 

I tried really a lot of examples available on this forum, but none was OK.

 

Thanks,

Pawel

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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