Forum Discussion
Simple Table and Dax makes nonsense.
Hello community,
I have a simple table where HC information is listed:
| Cost Center | Month | Gender | Type | Value |
| 1 | 1 | Male | Fix | 2 |
| 1 | 2 | Male | Fix | 3 |
| 1 | 1 | Male | Var | 2 |
| 1 | 2 | Male | Var | 3 |
| 1 | 1 | Male | Semi | 2 |
| 1 | 2 | Male | Semi | 3 |
| 1 | 1 | Female | Fix | 5 |
| 1 | 2 | Female | Fix | 9 |
| 1 | 1 | Female | Var | 6 |
| 1 | 2 | Female | Var | 10 |
| 1 | 1 | Female | Semi | 7 |
| 1 | 2 | Female | Semi | 11 |
| 2 | 1 | Male | Fix | 2 |
| 2 | 2 | Male | Fix | 3 |
| 2 | 1 | Male | Var | 2 |
| 2 | 2 | Male | Var | 3 |
| 2 | 1 | Male | Semi | 2 |
| 2 | 2 | Male | Semi | 3 |
| 2 | 1 | Female | Fix | 5 |
| 2 | 2 | Female | Fix | 9 |
| 2 | 1 | Female | Var | 7 |
| 2 | 2 | Female | Var | 11 |
| 2 | 1 | Female | Semi | 9 |
| 2 | 2 | Female | Semi | 13 |
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:
Where is the issue in my DAX?
Thanks
D
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")
3 Replies
- amitchandak
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/
- danielboi
Helper I
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")
- amitchandak
Super User
danielboi , sorry one mistake from my side
Male HC fix/var:=
CALCULATE(sum([Value]),
filter(Table1, Table1[Type] IN {"Fix", "Var"} &&
Table1[Gender]="Male") )