- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

If then in DAX Calculation
Hello All,
I am new to Power Bi.
I have small dax calculation. etc
I need if then else like below.
I created a table in power bi with these values APAC,EMEA and put in slicer
Now my requirement is
if Slicervalue ='APAC' then it has to check another conditions
Type= 'Phone' then the calculation like sum(Phonesales),
Type= 'Tablet' then the calculation like sum(Tabletsales)
else if Slicervalue ='EMEA'
condition Type= 'Phone' then the calculation like sum(Phonesales),
Type= 'Tablet' then the calculation like sum(Tabletsales) ....
not sure how to write this in dax.
Could any one please help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @Anonymous ,
I create the following sample data.
Then use the measure:
Measure =
SWITCH (
SELECTEDVALUE ( Slicer[Name] ),
"Phone", SUM ( DB_Region[Phonesales] ),
"Tablet", SUM ( DB_Region[Tabletsales] )
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @Anonymous ,
I create the following sample data.
Then use the measure:
Measure =
SWITCH (
SELECTEDVALUE ( Slicer[Name] ),
"Phone", SUM ( DB_Region[Phonesales] ),
"Tablet", SUM ( DB_Region[Tabletsales] )
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi, @Anonymous
Try it like this:
SWITCH(TRUE(),
MAX('Table'[Slicer]) = "APAC",
SWITCH(TRUE(),
'Table'[Type] = "Phone", SUM('Table'[Phonesales]),
'Table'[Type] = "Tablet", SUM('Table'[Tabletsales])
),
MAX('Table'[Slicer]) = "EMEA",
SWITCH(TRUE(),
'Table'[Type] = "Phone", SUM('Table'[Phonesales]),
'Table'[Type] = "Tablet", SUM('Table'[Tabletsales])
)
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi vojtechsima,
Actually I explained my problem reversly.
Here Phone and Tablet are slicer values from a table I created in power bi
APAC and EMEA are region field values coming from Region table from db
Could you suggest how to change the above formula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi, @Anonymous
Should be the same, only I forgot to add MAX:
Measure2 = SWITCH(TRUE(),
MAX('Table'[Slicer]) = "APAC",
SWITCH(TRUE(),
MAX('Table'[Type]) = "Phone", SUM('Table'[Phonesales]),
MAX('Table'[Type]) = "Tablet", SUM('Table'[Tabletsales])
),
MAX('Table'[Slicer]) = "EMEA",
SWITCH(TRUE(),
MAX('Table'[Type]) = "Phone", SUM('Table'[Phonesales]),
MAX('Table'[Type]) = "Tablet", SUM('Table'[Tabletsales])
)
)

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
11-05-2024 10:18 AM | |||
11-13-2024 01:14 AM | |||
10-07-2024 03:08 AM | |||
10-30-2024 11:30 AM | |||
08-31-2024 07:08 PM |