Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213916

Using SWITCH with OR (or Multple Criteria)

$
0
0

Is there a way to add a second columns criteria to a SWITCH function?

 

In short, I would like to make a calculation if the STORE # = one of a list OR if the beginning of the Coupon = a certain phrase.  The data is in the same table, but different columns.

 

I started with this to calculate based on the store number only.  Now I need to add the coupon name.

Calculation = CALCULATE((SUM('sales_order'[discount_amount])*-1)*.5,SWITCH('sales_order'[store_id],8,TRUE(),37,TRUE(),38,TRUE(),39,TRUE(),44,TRUE(),0))

 

So in excel I would do something like this to find the beginnging text in the coupon. Unforunately I don't know how to add it to DAX as a condition or even if that is the right way.

 

IFERROR(TRIM(LEFT('sales_order'[coupon],FIND("-",'sales_order'[coupon])-1))="COUPON TEXT",0)))

(I know there may be other ways, but hopefully you get the idea)

 


Viewing all articles
Browse latest Browse all 213916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>