March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello dear Desktop users, good morning.
I am stuck in a DAX measure related to ABC Customer Segmentation. My current formula is as below, unfortunately the result brings 2 categories (A and B) I would like it to return always the top one, A => B => C... but had trouble, could anyone help me?
rules (upper and lower boundries) to categorize the customer
Unfortunately, my measure is bringing 2 categories, it should only be a....
Solved! Go to Solution.
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:
Hi,
I'd recommend making calculated tables along the way so that you can see the outputs (e.g. output Products in class as a calculated table and make sure it's what you're expecting). Then it'll be much easier to see where it's going wrong.
Hello @pbiuseruk good afternoon.
Yes, I tried that and know that the issue is in the OR clause (since based on profitability it would fall in one category and based on revenue on another)... The issue is that I could not find a way to return only one category and prioritize the upper one (A->B-> C)...
Thank you for the input 🙂
If you can see there's multiple values being returned in the table and you only want one based on precedence, then you'd need to do an if or switch condition in the Result variable. e.g. If category A exists, then take value A, if Category B exists then take value B, etc...
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.
Absolutely, attached a sample file:
https://drive.google.com/file/d/1J_XdL6Zi1Z5x0aqBIr54lYvuUrX32Xpg/view?usp=sharing
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))
@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.
You are welcome. My formula will work absolutely fine once you correct categories table.
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?
No, this is bringing the category A B and C instead of the profit
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:
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
86 | |
70 | |
51 |
User | Count |
---|---|
206 | |
150 | |
97 | |
78 | |
69 |