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

Filters and DAX - Same Outcome...How?

If I have a Card visual with a number on it (let's say 700) that used 3 filters on this visual to get to my '700'...those filters are 'AND' functions correct?  Can I write DAX to give me the same number without using filters at all?  I'm trying to create Pie Charts with data from 3 cards at a time that all are using filters.  It's not working.  I'm thinking a "Measure'.  Help. 

 

Example:  One Card has 700, another 200 and another 100.  I want to show 3 pieces totalling 1000.  I can't merge Cards on 1 Pie Chart. ???

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Medmanage101 ,

I created some data:

vyangliumsft_0-1678950540045.png

 

Here are the steps you can follow:

1. Create measure.

You may consider using three MEASURES:

Flag1 =
SUMX(
    FILTER(ALL('Table'),'Table'[Group]="A"&&'Table'[Index]=1),[Value])
Flag2 =
SUMX(
    FILTER(ALL('Table'),'Table'[Group]="B"&&'Table'[Index]=2),[Value])
Flag3 =
SUMX(
    FILTER(ALL('Table'),'Table'[Group]="C"&&'Table'[Index]=3),[Value])

Or use the Switch() function:

All =
SWITCH(
    TRUE(),
    MAX('Table'[Group])="A",
    SUMX(FILTER(ALL('Table'),'Table'[Group]="A"&&'Table'[Index]=1),[Value]),
    MAX('Table'[Group])="B",
    SUMX(FILTER(ALL('Table'),'Table'[Group]="B"&&'Table'[Index]=2),[Value]),
    MAX('Table'[Group])="C",
    SUMX(FILTER(ALL('Table'),'Table'[Group]="C"&&'Table'[Index]=3),[Value]))

2. Result:

vyangliumsft_1-1678950540050.png

 

Best Regards,

Liu Yang

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

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @Medmanage101 ,

I created some data:

vyangliumsft_0-1678950540045.png

 

Here are the steps you can follow:

1. Create measure.

You may consider using three MEASURES:

Flag1 =
SUMX(
    FILTER(ALL('Table'),'Table'[Group]="A"&&'Table'[Index]=1),[Value])
Flag2 =
SUMX(
    FILTER(ALL('Table'),'Table'[Group]="B"&&'Table'[Index]=2),[Value])
Flag3 =
SUMX(
    FILTER(ALL('Table'),'Table'[Group]="C"&&'Table'[Index]=3),[Value])

Or use the Switch() function:

All =
SWITCH(
    TRUE(),
    MAX('Table'[Group])="A",
    SUMX(FILTER(ALL('Table'),'Table'[Group]="A"&&'Table'[Index]=1),[Value]),
    MAX('Table'[Group])="B",
    SUMX(FILTER(ALL('Table'),'Table'[Group]="B"&&'Table'[Index]=2),[Value]),
    MAX('Table'[Group])="C",
    SUMX(FILTER(ALL('Table'),'Table'[Group]="C"&&'Table'[Index]=3),[Value]))

2. Result:

vyangliumsft_1-1678950540050.png

 

Best Regards,

Liu Yang

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

@Medmanage101 ,The information you have provided is not making the problem clear to me. Can you please explain with an example.

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Appreciate your Kudos.

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.