DAX Lookup by Limit

srehman

Board Regular
Joined
Jan 4, 2020
Messages
210
Office Version
  1. 2016
Platform
  1. Windows
Hi Team,

I need to achieved result by DAX.

Class table & Product table lookup (if percentage less than or equal to 15% assign class "AA" and so on.
I have watched some videos about frequency category. But here everything in percentages.

Product percentages achieved from Qty could be any , i can provide it if you need any info.

Please if this data not help to achieved results or not according forum please disregard this post.

Thanks


Book1
AB
2Class Table
3ClassCalss Percentages
4AA15%
5A30%
6B50%
7C75%
8D100%
Sheet1



Book1
EFG
2Prouduct TableNeed to achieved by DAX
3ProuductPercentagesLESS THAN OR EQUAL TO CLASS Percenatge
4A112%AA
5A140%B
6A185%C
7B15%AA
8B175%C
9B229%A
10C10.5%AA
11C262%C
12C34%AA
Sheet1
 
Good Morning JustynaMK,
Thanks for your response i spent lot of time thinks in many ways with limited knowledge. I was watching video about IF condition statements and found some amazing stuff about switch () TRUE() by using it i can achieved result in very simple way.

So i only need to work on Prod table i have used SWITCH() to conditionally assign class on Percentages column, which provide a calculated column

Could be following approach not good at professional level. As i am beginner trying and spending lot of time to learn.



Class =
switch(
TRUE(),
ProdTab[Percentages] <= 0.15, "AA",
ProdTab[Percentages] <= 0.30, "A" ,
ProdTab[Percentages] <= 0.50,"B",
ProdTab[Percentages] <= 0.75,"C",
ProdTab[Percentages] <= 1,"D",
"None"
)

Thanks a lot you provide me a hope to learn in different way.
 

Attachments

  • Result  by switch.PNG
    Result by switch.PNG
    65.7 KB · Views: 6
  • By Switch.PNG
    By Switch.PNG
    69.6 KB · Views: 5
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Oh it is a very good approach indeed :-) I'm a big fan of SWITCH function myself.

The only negative about it is that all conditions (i.e. bands) are specified within a function. So if you wanted the user to be able to easily modify the bands (e.g. from 15% to 20% for "AA") or if your source was changing frequently, the previous solution that we have developed earlier in this thread would be more flexible as it is linked directly to the source (i.e. Excel file). However, in the case of SWITCH function, you (administrator/developer) would need to manually adjust the SWITCH parameters every time such need arises.

Both solutions are very good, it all depends on the environment you work in and what are the business needs.
 
Upvote 0
You are absolutely right i like first solution as well as you solved,
I have same thought what if percentage values will change with different scenarios.
I will definitely find out something when i learn more.
At this time for me very difficult to find out how can i change formulas according to the conditions and which one is correct choice.
I am trying.
Once again thanks for your support and time.
 
Upvote 0
Don't worry, we're all learning! Enjoy the process :-)
Take care & good luck with your report
 
Upvote 0

Forum statistics

Threads
1,223,768
Messages
6,174,411
Members
452,562
Latest member
Himeshwari

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