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

DAX filter

Hi,

 

I need to calculate the Sales of a team ignoring the Single salesperson selection but considering the team the person belongs to:team sales power bi.PNG 

In this case, I need the team sales to be the sum of ONLY France sales. I wrote the formula 

Team Sales = CALCULATE([Individual sales],all('Kam - team'[Kam]))
 
which is not considering the Kam filter, as I wanted, but it is returning the total sales of all of the teams and I need only France.
 
Thanks,

 

 

 

7 REPLIES 7
v-xicai
Community Support
Community Support

Hi @Anonymous  ,

 

Does that make sense? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

 

Best regards

Amy

v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You may create measure like DAX below.

 

Team Sales= CALCULATE([Individual sales], FILTER(ALLSELECTED('Kam - team'[Team]), 'Kam - team'[Team] =MAX('Kam - team'[Team])))

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

Selecting in a variable and using is later should give

 

Team Sales = 
 var _team= allselected('Kam - team'[Team])
 return
 CALCULATE([Individual sales],all('Kam - team'[Kam]),'Kam - team'[Team] =_team)
or
CALCULATE([Individual sales],all('Kam - team'[Kam]),'Kam - team'[Team] in _team)

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Anonymous
Not applicable

Team Sales = CALCULATE(
sum([Individual sales]),
all('Kam-team'[salesperson]),
allselected('Kam - team'[Kam]))

Maybe something like this?

Not sure if { all('Kam-team'[salesperson]),} is needed

Anonymous
Not applicable

Hi wvdv,

 

Thanks for your answer.

 

Actually I have this dimension table:

 

kam-teams pics.PNG

I need that  if the filter is Tiphaine Boehm team sales sum all of the sales when team = FR, if the filter is Tania Gracia then sum all of the sales with team = ES etc

Anonymous
Not applicable

Okay this works in my test:
Where table 1 has two columns: kam and team.
Table 2 has two columns: kam and sales.
I only recreated part of your table.
Relationship is one to many from table 1 to table 2.
 
Measure = CALCULATE(SUM(Table2[Sales]),
ALL(Table1[Kam]),
ALLSELECTED(Table1[Team]))
Anonymous
Not applicable

Btw: be aware that in my example, you would have to filter kam on table 1, not on table 2.

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.