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
LD1
Helper III
Helper III

Filter function with DAX

Hi everyone, 

 

I would like to put a filter in a formula but i didn't find the solution on the web.

Can you help me to solve it please ? 

 

Here this is my explication :

 

1. I have 3 data in a table in the table "Marque"

Vetement
Chaussures
Accessoires

 

2. I would like to create one formula for each data of the table "Marque":

            => Sum of "Turnover€ "for [Marque="Vetement"]

            => Sum of "Turnover€" for [Marque="Chaussures"]

            => Sum of "Turnover€" for [Marque="Accessoires"]

 

Why? Because when i create a Visual, i have a couple of formula by "client" but i don't want to multiplicate all values with the data "Marque" only the Turnover. 

 

I haven't an other solution, if you have an optimisation of it, i'll take it 😉

 

LD1_0-1672667769027.png

 

Thank you in advance,

 

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@LD1 Try:

Measure = SUMX(FILTER('Marque',[Column] = "Vetement"),[Value])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

v-yiruan-msft
Community Support
Community Support

Hi @LD1 ,

You can follow the below methods to get it, please find the details in the attachment.

1. Create a slicer using the field [Marque]

yingyinr_0-1672721224693.png

2. Create measures as below to get it

Sum of Turnover for Vetement = CALCULATE(SUM('Table'[Turnover€]),'Table'[Marque]="Vetement")
Sum of Turnover for Chaussures = CALCULATE(SUM('Table'[Turnover€]),'Table'[Marque]="Chaussures")
Sum of Turnover for Accessoires = CALCULATE(SUM('Table'[Turnover€]),'Table'[Marque]="Accessoires")

yingyinr_1-1672721284813.png

If the above one can't help you get the expected result, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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

View solution in original post

3 REPLIES 3
LD1
Helper III
Helper III

@v-yiruan-msft @Greg_Deckler 

It's amazing and finally so easy... ! Thank you for your help and your solution. 

Have a nice day

 

v-yiruan-msft
Community Support
Community Support

Hi @LD1 ,

You can follow the below methods to get it, please find the details in the attachment.

1. Create a slicer using the field [Marque]

yingyinr_0-1672721224693.png

2. Create measures as below to get it

Sum of Turnover for Vetement = CALCULATE(SUM('Table'[Turnover€]),'Table'[Marque]="Vetement")
Sum of Turnover for Chaussures = CALCULATE(SUM('Table'[Turnover€]),'Table'[Marque]="Chaussures")
Sum of Turnover for Accessoires = CALCULATE(SUM('Table'[Turnover€]),'Table'[Marque]="Accessoires")

yingyinr_1-1672721284813.png

If the above one can't help you get the expected result, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

@LD1 Try:

Measure = SUMX(FILTER('Marque',[Column] = "Vetement"),[Value])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors