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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MK_Process
Helper I
Helper I

Lookup Value

Hi

We need to add a column to the database where we use teh lookup functions.

Eg:  in 1 column i have the numbers 1,2,3,4, upto 90.

We need to run a formula using lookup where the number is between 1-30 then it shows 1 Month. If its 31 to 60 then 2 Month and if its 61 to 90 then 3 Months.,

Need Help.

 

Fasial

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @MK_Process ,

Please have a try.

Create a column.

Column = IF('Table'[value]>=1&&'Table'[value]<=30,"1",IF('Table'[value]>=31&&'Table'[value]<=60,"2","3"))

Or try this one.

Column 2 = SWITCH(TRUE(),'Table'[value]>=1&&'Table'[value]<=30,1,'Table'[value]>=31&&'Table'[value]<=60,2,3)

11.PNG

 

Best Regards

Community Support Team _ Polly

 

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

 

View solution in original post

4 REPLIES 4
v-rongtiep-msft
Community Support
Community Support

Hi @MK_Process ,

Please have a try.

Create a column.

Column = IF('Table'[value]>=1&&'Table'[value]<=30,"1",IF('Table'[value]>=31&&'Table'[value]<=60,"2","3"))

Or try this one.

Column 2 = SWITCH(TRUE(),'Table'[value]>=1&&'Table'[value]<=30,1,'Table'[value]>=31&&'Table'[value]<=60,2,3)

11.PNG

 

Best Regards

Community Support Team _ Polly

 

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

 

MK_Process
Helper I
Helper I

Hi Amit

Thanks for your Reply

In the above formula, if we need to add like Less than or equal 30 then 1. The greater than 30 and less than or equal 60 then 2 and rest 3.

 

amitchandak
Super User
Super User

@MK_Process , a new column

 

Month = Switch( True() ,

[Column] <= 30 ,1 ,

[Column] <= 60 ,2 ,

3)

OK. But in this case if the number is 15, will it be accounted in 1 or 2. Because 15 is less than 30 and its also less than 60.

In excel we use the look up function with a table as follows:

1      30   1 Month

31    60.   2 Month

61.   999.  More than 2 Months

 

Then on this we run look up formula. similarly cant we do here in power BI?

 

Faisal

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.