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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
VS_5
New Member

Power BI - Conditional sum column

There is a table with the structure below where I have Revenue for months 1 thru 12 for Account....... (Rev1, Rev2...Account, are different columns) 

 

I'd like to Add Rev1 numbers for only accounts "ABC" and "DEF". So I want to see a Total field 15 for Accounts ABC and DEF. Please advise the best way to acheive it. 

 

Rev1 Rev2 Rev3.....Rev12 Account

10      15     12         14       ABC

5         6       9           11      DEF

4         15     7           9        GHI

32        19     1          12      XYZ

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@VS_5 - 

In addition to Unpivoting your fact table, I would add additional dimension tables for Account and Date. This will allow you to add meaningful groupings and other descriptive attributes. For example, your account table could begin with all of the distinct accounts, and then add a column for "Account Category", which could be used to put accounts into buckets. 

I hope this helps. If it does, please Mark as a solution.
I also appreciate Kudos.
Nathan Peterson

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@VS_5 -

The most straightforward solution is to use "Unpivot" in Power Query. This will produce 3 columns: Account, Month, and Revenue.

Then, in your report, you can add a slicer or filter to limit the accounts.

I hope this helps. If it does, please Mark as a solution.
I also appreciate Kudos.
Nathan Peterson

Thank you for taking time to respond to my query. I like the idea of Unpivoting the columns. As my actual table is huge and I'm trying to convert excel report to Power BI, I will have to use formulas like adding 2 or 3 cells with the condition on more than 2 Accounts (say Add Rev2 cost for accounts ABC, DEF and GHI).

 

So what is the best way to specify that condition on Accounts?

 

Again, thanks for your time. 

Hi @VS_5 ,

Have you solved your problem?

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

If you still need help, please share your desired output so that we could help further on it.

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@VS_5 - 

In addition to Unpivoting your fact table, I would add additional dimension tables for Account and Date. This will allow you to add meaningful groupings and other descriptive attributes. For example, your account table could begin with all of the distinct accounts, and then add a column for "Account Category", which could be used to put accounts into buckets. 

I hope this helps. If it does, please Mark as a solution.
I also appreciate Kudos.
Nathan Peterson

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.