cancel
Showing results for
Did you mean:
Frequent Visitor

## if or a switch statement

Hi ,

I am new to Power BI and need some help with the below case. Appreciate if someone can help with the DAX formula for the case. I am not sure IF of SWITCH statement works best for the below case.

Please Note: I will have "AAA" and "BBB" as part of a visual filter too. Thank You.

(CASE

WHEN Field1 = "AAA" then "RETAIL * GROWTH FACTOR" AND "ONLINE * GROWTH FACTOR"

ELSE

WHEN Field1 = "BBB" then "RETAIL" AND "ONLINE"

END)

1 ACCEPTED SOLUTION

Accepted Solutions
Resident Rockstar

## Re: if or a switch statement

Hi @Rubal ,

It seems that you need to chang your query to dax in power bi.

Based on your logic, we could create the dax like below.

```=
IF (
Field1 = "AAA",
"RETAIL * GROWTH FACTOR" && "ONLINE * GROWTH FACTOR",
IF ( Field1 = "BBB", "RETAIL" && "ONLINE" )
)```

If it is convenient, could you share your data sample which could reproduce your scenario so that we could help further on it?

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Highlighted
Solution Sage

Hi @Rubal

Cheers!
A

Frequent Visitor

## Re: if or a switch statement

yes, I have. Need the formula example for my specific case though

Resident Rockstar

## Re: if or a switch statement

Hi @Rubal ,

It seems that you need to chang your query to dax in power bi.

Based on your logic, we could create the dax like below.

```=
IF (
Field1 = "AAA",
"RETAIL * GROWTH FACTOR" && "ONLINE * GROWTH FACTOR",
IF ( Field1 = "BBB", "RETAIL" && "ONLINE" )
)```

If it is convenient, could you share your data sample which could reproduce your scenario so that we could help further on it?

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Resident Rockstar

## Re: if or a switch statement

Hi @Rubal ,

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

If you still need help, please share some data sample and your desired output.

Best  Reagards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Announcements

#### New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

#### ‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

#### Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

#### Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

#### Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors