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
I have a regular report with a table showing seller's results in Power BI.
The distribution channel imposed different limits on various product lines which should not be exceeded and I want my report to check the results against these limits and highlight seller entries where the limit is breached so it can be quickly referred for inevstigation and corrected as needed.
I wanto to build this in a way that will continue over time as the limits can be changed each year.
a) do I need to create a combo of product&year in sales table against my limit reference table
b) how would i create a measure to check the limit for each product and confrim if this is exceeded or not
b) is there an easy way to build the above measure into a conditional formatting to be used in the sales reporting table or is there a better way to implement this?
Would appreciate any views or suggestions
Solved! Go to Solution.
ColorCode =
VAR SalesAmount = Sales[SalesAmount]
VAR ProductLimit =
CALCULATE(
MAX(Limits[Limit]),
FILTER(Limits,
Limits[Product] = Sales[Product] &&
Limits[Year] = YEAR(Sales[Date])
)
)
RETURN
IF(
ISBLANK(ProductLimit),
BLANK(), -- No limit set (no color if blank)
IF(SalesAmount > ProductLimit, 1, 0) -- 1 for exceeded (red), 0 for within limit (green)
)
//Use 1 and 0 for color combination in conditional formatting
Did I answer your question? If so, please mark my post as a solution!
Proud to be a Super User!
Here are few suggestions for your scenario, what I got in my mind.
Product
, Year
, and Limit
columns to easily manage limit changes over time.Product
and Year
instead of calculated columns to keep the model cleaner.
Did I answer your question? If so, please mark my post as a solution!
Proud to be a Super User!
Thank you for your reply
I already have the limit table set up as described and have now connected it to my 'sales' table as suggested.
Could I please get some help with the DAX formula for my example:
product A, B, C
limit
product A in 2024 1m, 2025 1m
product B in 2024 2m, 2025 3m
product C in 2024 1m, 2025 1.5m
(-the limits are imposed for each sale so should check each entry and not accumulation
- I currently have about 30 different products so not sure if I need to specify each one of them or can write a DAX formula to looks for an exact match in the limit table)
Thank you for the remaining suggestions for filter and data activator, very useful!
ColorCode =
VAR SalesAmount = Sales[SalesAmount]
VAR ProductLimit =
CALCULATE(
MAX(Limits[Limit]),
FILTER(Limits,
Limits[Product] = Sales[Product] &&
Limits[Year] = YEAR(Sales[Date])
)
)
RETURN
IF(
ISBLANK(ProductLimit),
BLANK(), -- No limit set (no color if blank)
IF(SalesAmount > ProductLimit, 1, 0) -- 1 for exceeded (red), 0 for within limit (green)
)
//Use 1 and 0 for color combination in conditional formatting
Did I answer your question? If so, please mark my post as a solution!
Proud to be a Super User!
Hey,
if you have limit table, it is connected to sales and you have a table that shows values per product then you can use a measure like this to set a color:
Change Color =
VAR _value = SUM('YourTable'[Sales]) --or put measure/calculation on how you calculate sales
VAR _limit = SUM('LimitTable'[Value])
RETURN
IF (
_value<_limit,
"#6dae89", -- Green Color
"#ed999e" -- Red Color
)
And then later put this measure into conditional formating for needed column (conditional formating based on field value, examples ho to do it: Apply conditional table formatting in Power BI - Power BI | Microsoft Learn ).
Hope it helps!
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
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 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |