cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rtum
Regular Visitor

Multiple Case from Tableau to DAX

HI,

I have the below in formulas for A and B in Tableau,Parameter need to be defined as A/B.

 

How can i convert multiple Case from Tableau into DAX.All the columns are in a single Table.

 

A

CASE [Policy or Risk Survival:]

    WHEN 'ABC' THEN SUM([M Count Policy])

    WHEN 'EFG' THEN SUM([M Count Item])/SUM([M Count Policy])

    WHEN 'IJK' THEN SUM([M EarnedExposure Policy])

    WHEN 'LMNO' THEN SUM([M EarnedExposure Item])

    WHEN 'PQRST' THEN SUM([M Limit Size])/SUM([M Count Policy])

    WHEN 'XYZ' THEN SUM([M Limit Size])/SUM([M Count Item])

END

B

{EXCLUDE [SEQ],[D C Seq Group]:

                    CASE [Policy or Risk Survival:]

                        WHEN 'ABC' THEN SUM(IF [SEQ]=0 THEN [M Count Policy] END)

                        WHEN 'EFG' THEN SUM(IF [SEQ]=0 THEN [M Count Item] END)/SUM(IF [SEQ]=0 THEN [M Count Policy] END)

                        WHEN 'IJK' THEN SUM(IF [SEQ]=0 THEN [M EarnedExposure Policy] END)

                        WHEN 'LMNO' THEN SUM(IF [SEQ]=0 THEN [M EarnedExposure Item] END)

                        WHEN 'PQRST' THEN SUM(IF [SEQ]=0 THEN [M Limit Size] END)/SUM(IF [SEQ]=0 THEN [M Count Policy] END)

                        WHEN 'XYZ' THEN SUM(IF [SEQ]=0 THEN [M Limit Size] END)/SUM(IF [SEQ]=0 THEN [M Count Item] END)

                    END    

}

 

Regards,

Raj

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Rtum Use a SWITCH statement and you can nest these. Also, be sure you understand how to use SWITCH(TRUE()...) as it is handy although not sure you require it in your circumstance.


@ me in replies or I'll lose your thread!!!
Check out my External Tool for Power BI Desktop! Microsoft Hates Greg's Quick Measures
YouTube Channel! Microsoft Hates Greg
Check out my latest book!

View solution in original post

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Hi @Rtum ,

 

Can you explain what the measure actually does (for those not familiar with Tableau and please show a sample of your data tables?)


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

When i select ABC Policy or Risk Slicer,It should return the 

WHEN 'ABC' THEN SUM([M Count Policy])/

WHEN 'PCS' THEN SUM(IF [SEQ]=0 THEN [M Count Policy] END)

Greg_Deckler
Super User
Super User

@Rtum Use a SWITCH statement and you can nest these. Also, be sure you understand how to use SWITCH(TRUE()...) as it is handy although not sure you require it in your circumstance.


@ me in replies or I'll lose your thread!!!
Check out my External Tool for Power BI Desktop! Microsoft Hates Greg's Quick Measures
YouTube Channel! Microsoft Hates Greg
Check out my latest book!

View solution in original post

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors