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
Birch
Frequent Visitor

sum with filters...

Hi,

 

I have 2 tables - one wih salespersons names and there budget for the year (and pr. month) and one table with all sales for all salespersons.

I need to do a SUM of units pr. salesperson and pr. timeframe (MTD and YTD)

 

In Excel I can do a SUMIF and use the salespersons name as a VAR, but how can I do this in PowerBI Desktop?

 

Thanks

1 ACCEPTED SOLUTION

Hi Birch,

 

According to your description, it seems that you need a dynamic column name, right?

 

Based on my research, we cannot use DAX expression to define a column name which you can see on the screenshot below.
Capture.PNG

 

If this is not what you want, please elaborate your requirement, so that we can make further analysis.

 

Regards,
Charlie Liao

View solution in original post

4 REPLIES 4
MattAllington
Community Champion
Community Champion

Welcome to power bi - where to start?!  You don't really give enough info to give a clear answer. The short answer is you use the formula =CALCULATE (sum(tableName[units column]),tablename[sales person]="Birch") but believe me the long answer is much more involved. You can learn it, and you will learn quickly if you read a book like the one I wrote specifically for Excel users leaning Power Pivot/Power BI. http://xbi.com.au/learndax

 

 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Hi

 

I used this

 

SalesYTD = CALCULATE(SUM(OpportunitySet[No. of Units]);OpportunitySet[This Year Closed]="YES";OpportunityStateOptionSet[Status]="WON")

 

this works for me 🙂

Birch
Frequent Visitor

This leads me into me next problem - I have 12 columns (named 1, 2, 3.... 12) and I need a new column showing the number in the column with name = MONTH(TODAY()) - can I do that?

Hi Birch,

 

According to your description, it seems that you need a dynamic column name, right?

 

Based on my research, we cannot use DAX expression to define a column name which you can see on the screenshot below.
Capture.PNG

 

If this is not what you want, please elaborate your requirement, so that we can make further analysis.

 

Regards,
Charlie Liao

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.