Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I am new to PBI and find it difficult to highlight the maximum and minimum values row-wise using DAX in the visual (matrix table). I have rows as Product Names from the Product table, columns as Warehouse Name from the Sales Order table, and values as total revenue (which is a measure created on the Sales Order table).
I want to know the maximum and minimum revenue generated from which warehouse for each product.
Below are the screenshots of Visual and column names
Solved! Go to Solution.
Hi @jaythakur32
Based on your needs, I have created the following table.
You can use the following dax to get the result you want.
Measure 2 = var _tab=SUMMARIZE(ALLSELECTED('Table (2)'[area]),'Table (2)'[area], "@sumvalue",CALCULATE(SUM('Table (2)'[value])))
var _max= maxx( _tab,[@sumvalue])
var _min= MINX(_tab,[@sumvalue])
var _area=SELECTEDVALUE('Table (2)'[area])
return SWITCH(TRUE(),sum('Table (2)'[Value])=_max&&_area="a","grey", sum('Table (2)'[Value])=_max&&_area= "b","grey",sum('Table (2)'[Value])=_max&&_area="c","grey",sum('Table (2)'[Value])=_max&&_area="d","grey",sum('Table (2)'[Value])=_min&&_area="a","green", sum('Table (2)'[Value])=_min&&_area= "b","green",sum('Table (2)'[Value])=_min&&_area="c","green",sum('Table (2)'[Value])=_min&&_area="d","green")
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @jaythakur32
Based on your needs, I have created the following table.
You can use the following dax to get the result you want.
Measure 2 = var _tab=SUMMARIZE(ALLSELECTED('Table (2)'[area]),'Table (2)'[area], "@sumvalue",CALCULATE(SUM('Table (2)'[value])))
var _max= maxx( _tab,[@sumvalue])
var _min= MINX(_tab,[@sumvalue])
var _area=SELECTEDVALUE('Table (2)'[area])
return SWITCH(TRUE(),sum('Table (2)'[Value])=_max&&_area="a","grey", sum('Table (2)'[Value])=_max&&_area= "b","grey",sum('Table (2)'[Value])=_max&&_area="c","grey",sum('Table (2)'[Value])=_max&&_area="d","grey",sum('Table (2)'[Value])=_min&&_area="a","green", sum('Table (2)'[Value])=_min&&_area= "b","green",sum('Table (2)'[Value])=_min&&_area="c","green",sum('Table (2)'[Value])=_min&&_area="d","green")
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
That's pretty straightforward if your data is in the right format (as it seems to be). You need to compare each value agains the min and max value that you get when you apply REMOVEFILTERS(...[Warehouse Code])
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
13 | |
11 | |
9 | |
6 |