July 27, 2016 at 2:01 pm
I'm trying to re-create the following CASE statement with DAX SWITCH:
CASE actl_sd_shp_ev_lcl_dt_hash_key
WHEN 99991231 THEN RVS_OTLK_STK_DT_HASH_KEY
WHEN NULL THEN RVS_OTLK_STK_DT_HASH_KEY
WHEN '' THEN RVS_OTLK_STK_DT_HASH_KEY
ELSE actl_sd_shp_ev_lcl_dt_hash_key
END AS Stock_Date
My DAX version is this:
=SWITCH([actl_sd_shp_ev_lcl_dt_hash_key], 99991231, [rvs_otlk_stk_dt_hash_key], [actl_sd_shp_ev_lcl_dt_hash_key])
However, I have not been able to do "" or NULL within the SWITCH function. How do I do that? I keep getting errors.
July 27, 2016 at 2:12 pm
Did you try something like
SWITCH([Field],BLANK(),...)
?
BLANK() in DAX is like T-SQL NULL. (Not the same, though, I don't think...)
July 27, 2016 at 5:23 pm
Thanks, I think that did the trick!
July 27, 2016 at 9:33 pm
If you want a couple of good books on DAX, get Rob Collie's book (see http://www.powerpivotpro.com). He's great at breaking things down and explaining them. And you can download all the files for the book and play along.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply