Forum Discussion
Help with ABC Customer categorizing - DAX
- 1 year ago
Slightly confused what you're expecting (please explain) - this is the result I get when I add your existing measure with the new measure I made:
Hello, the issue here is that the columns are A,B,C And the Measure is bringing the profitability, I can't do a switch case...
It's hard for me to visualise this but if you share a PBIX file with some dummy data in there, I can take a look.
- Okazakipedro1 year agoHelper I
Absolutely, attached a sample file:
https://drive.google.com/file/d/1J_XdL6Zi1Z5x0aqBIr54lYvuUrX32Xpg/view?usp=sharing- pbiuseruk1 year agoResolver IV
Could you try using this:
NewMeasure = Var ControllingCustomerCode = SELECTEDVALUE(SampleData[Controlling Customer Code]) RETURN CALCULATE(LASTNONBLANK ( Support_Category[Category], 1 ), FILTER ( Support_Category, [measure_job_totalProfitEur] > 'Support_Category'[ProfitLowerBoundaries] && [measure_job_totalProfitEur] <= 'Support_Category'[ProfitUpperBoundaries] || ( [measure_job_totalRevenueEur] > 'Support_Category'[RevenueLowerBoundaries] && [measure_job_totalRevenueEur] <= 'Support_Category'[RevenueUpperBoundaries] ) ), SampleData[Controlling Customer Code] = ControllingCustomerCode )Then make a table with the company code, the measure for the euro amount and this new measure.
Please let me know if this is what you were after?- Okazakipedro1 year agoHelper I
No, this is bringing the category A B and C instead of the profit
- Ashish_Mathur1 year agoSuper User
Hi,
Given the buckets that you have in the support category table, 1,652 should fall in Category C (total of shipment number 1098 and 1250). Shipment number 1167 does not fall in any category/bucket. This is the measure i wrote
category_abcProfitEurr v1 = CALCULATE([measure_job_totalProfitEur],FILTER(ADDCOLUMNS(VALUES(SampleData[ShipmentNo]),"ABCD",CALCULATE([measure_job_totalRevenueEur],CALCULATETABLE(VALUES(SampleData[ShipmentID]))),"EFGH",CALCULATE([measure_job_totalProfitEur],CALCULATETABLE(VALUES(SampleData[ShipmentID])))),COUNTROWS(FILTER(Support_Category,[ABCD] >= Support_Category[RevenueLowerBoundaries] && [ABCD] < Support_Category[RevenueUpperBoundaries]&&[EFGH]>=Support_Category[ProfitLowerBoundaries]&&[EFGH]<Support_Category[ProfitUpperBoundaries])) >0))- Okazakipedro1 year agoHelper I
Ashish_Mathur thanks but you see that the same value appears for A and B? this is the behaviour that I do not want, I would like it to show only A.