Forum Discussion
DAX help - filtering?
Hi all
New to Power BI here and complete novice when it comes to DAX! Would really appreciate any help.
I'm trying to use 'calculate' and 'filter' but keep getting error messages. Using the example below, i'd like to count up the amount of times 'red' 'orange' and 'yellow' appear in the column 'Colour' below (6 times), but also say 'light' in the column 'Light or dark' (4 times).
Can anyone help me with the correct expression to achieve this?
Thanks in advance.
| Colour | Light or Dark |
| Red | Light |
| Orange | Dark |
| Yellow | Light |
| Blue | Dark |
| Red | Dark |
| Orange | Light |
| Yellow | Light |
| Purple | Dark |
Hi Anonymous ,
Create a measure with below code:-
measure = COUNTROWS ( FILTER ( 'Table (4)', 'Table (4)'[Colour] IN { "Red", "Orange", "Yellow" } && 'Table (4)'[Light or Dark] = "Light" ) )Output:-
Thanks,
Samarth
2 Replies
- Samarth_18Community Champion
Hi Anonymous ,
Create a measure with below code:-
measure = COUNTROWS ( FILTER ( 'Table (4)', 'Table (4)'[Colour] IN { "Red", "Orange", "Yellow" } && 'Table (4)'[Light or Dark] = "Light" ) )Output:-
Thanks,
Samarth
- amitchandakSuper User
Anonymous , Create a measure like
calculate(count(Table[Colour]), filter(Table, Table[Colour] in {"red", "orange","yellow"} && Table[Light or Dark] ="Light"))