Forum Discussion
Product Profit Bucketing By Color
Hi All,
We have a requirement in our project, i just replicated the sccenario using AdventureworksDB.
sample data:
expected visual output:
we have to calculate the number of products, which difference between sales and cost is >200000 ,
difference between sales and cost is <200000 and >100000
and <100000
Thanks..
12 Replies
- AnonymousNot applicable
Hi,
Is the result image displaying the correct numbers or it is just an example?
Here's what i got:
Thanks.
- AnonymousNot applicable
plz share dax?
- AnonymousNot applicable
Hi Anonymous
Thanks for your reploy, the image content is just an example. Kindly share the DAX for the solution.
- AnonymousNot applicable
Hi Anonymous ,
Here's the link to the report:
https://1drv.ms/u/s!AikPceQOhqFEhAwHyrxppGS-gvn2?e=c5BFn5
Thanks.
- ibarrau
Super User
Hi, I think there are several ways to do this.
In case you are looking this validation row by row, I mean checking the difference on each row, the most common is to add a new column with two if conditions asking for the range values and the return will be text categorizing this three possibilities. This column can be created in Power Query or DAX. And easty way to categorize values is creating a group, example.
Then you can add this new column as legend in your visualization and a distinct count of productkey as values.
In case you want to check the difference in all sales of the product then you should create three measures, one by each range and use three values and no legend. Like this:
COUNTROWS (
FILTER (
ADDCOLUMNS (
SUMMARIZE ( Table, Table[ProductKey] ),
"Difference", SUM ( Table[Sales] ) - SUM ( Table[Cost] )
),
[Difference] > 200000
)
)Hope one of this helps
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.