Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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

@Anonymous 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!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

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

Hi @Anonymous ,

 

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.

Anonymous
Not applicable

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

@Anonymous 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!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.