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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
danielboi
Helper I
Helper I

Simple Table and Dax makes nonsense.

Hello community,

 

I have a simple table where HC information is listed:

Cost CenterMonth Gender TypeValue
11MaleFix2
12MaleFix3
11MaleVar2
12MaleVar3
11MaleSemi2
12MaleSemi3
11FemaleFix5
12FemaleFix9
11FemaleVar6
12FemaleVar10
11FemaleSemi7
12FemaleSemi11
21MaleFix2
22MaleFix3
21MaleVar2
22MaleVar3
21MaleSemi2
22MaleSemi3
21FemaleFix5
22FemaleFix9
21FemaleVar7
22FemaleVar11
21FemaleSemi9
22FemaleSemi13

 

Import this table into Data Model and add a measure:

Male HC fix/var:=
CALCULATE(

sum([Value]),

Table1[Type] IN {"Fix", "Var"},

Table1[Gender]="Male")

 

I use this "IN" because in the original talbe I need to filter for three attributes.

 

Add a pivot table where I add the measure and want to break down the measure value according to Type. What I get is this:

 

danielboi_0-1647510154178.png

 

Where is the issue in my DAX?

 

Thanks

D

1 ACCEPTED SOLUTION

@amitchandak Almost!

Need to close the filter argument right after the IN operator.

 

This way it works. Thanks for showing me the way though!

 

Male HC fix/var:=
CALCULATE(

sum([Value]),

filter(Table1, Table1[Type] IN {"Fix", "Var"}),

Table1[Gender]="Male"

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@danielboi , try like

Male HC fix/var:=
CALCULATE(

sum([Value]),

filter(Table1, Table1[Type] IN {"Fix", "Var"},

Table1[Gender]="Male") )

 

refer if if needed http://dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/

@amitchandak Almost!

Need to close the filter argument right after the IN operator.

 

This way it works. Thanks for showing me the way though!

 

Male HC fix/var:=
CALCULATE(

sum([Value]),

filter(Table1, Table1[Type] IN {"Fix", "Var"}),

Table1[Gender]="Male"

@danielboi , sorry one mistake from my side

 

Male HC fix/var:=
CALCULATE(

sum([Value]),

filter(Table1, Table1[Type] IN {"Fix", "Var"} &&

Table1[Gender]="Male") )

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.