Equivalent of LOOKUP in DAX?

dayanday

New Member
Joined
Feb 24, 2015
Messages
15
I have a function in excel table like below:

LOOKUP([ActivitySinceRegistration],{-65535,0,30,60,90,120,150,180,65535}, {"Not active at all","Active in 30 days","Active in 60 days","Active in 90 days","Active in 120 days","Active in 150 days","Active in 180 days","Inactive more than 180 days"})

Now I want to do the same in DAX, how should I do it? I'm thinking of using switch, but it seems like only handles discrete values like below? But I want it to handle the above case.

=SWITCH([Month], 1, "January", 2, "February", 3, "March", 4, "April"
, 5, "May", 6, "June", 7, "July", 8, "August"
, 9, "September", 10, "October", 11, "November", 12, "December"
, "Unknown month number" )

Thanks in advance.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Oh, I found the solution, I can use the switch function combing AND like below to get the result:

=SWITCH(TRUE(),[ActivityGapSinceRegistration]<0 , "less than 0", AND( [ActivityGapSinceRegistration]>=0,[ActivityGapSinceRegistration]<30), "greater than 0")
 
Upvote 0

Forum statistics

Threads
1,224,078
Messages
6,176,244
Members
452,716
Latest member
Elo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top