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.
Hello All,
I have the followong dataset :
COUNTRY | BRAND | KPI | PRIORITY | QTY |
COUNTRY_1 | BRAND_A | SALES | HIGH | 100 |
COUNTRY_1 | BRAND_B | SALES | HIGH | 10 |
COUNTRY_1 | BRAND_C | SALES | LOW | 45 |
COUNTRY_1 | TARGET | 800 | ||
COUNTRY_2 | BRAND_A | SALES | HIGH | 205 |
COUNTRY_2 | BRAND_B | SALES | HIGH | 78 |
COUNTRY_2 | BRAND_C | SALES | HIGH | 1 |
COUNTRY_2 | TARGET | 700 |
1) I defined a measure that calculate the Target per brand : Target per brand is sum of the volumes for rows whose KPI=TARGET, all brands.
Target per brand = CALCULATE (
SUM ( 'DATASET'[QTY] ),
ALL ( 'DATASET'[BRAND] ),
'DATASET'[KPI] = "TARGET"
)
It works fine :
BRAND | Target per brand | Remarks |
BRAND_A | 1500 | = 800 + 700 |
BRAND_B | 1500 | = 800 + 700 |
BRAND_C | 1500 | = 800 + 700 |
2) Now I want to create a similar measure that calculate the Target per brand if Priority is set to High for the brand in the country.
The result should be like this :
BRAND | Target per brand if high priority | Remarks |
BRAND_A | 1500 | = 800 + 700 |
BRAND_B | 1500 | = 800 + 700 |
BRAND_C | 700 | The priority of the BRAND_C is LOW for the COUNTRY_1, so the TARGET qty for COUNTRY_1 is ignored when calculating the measure. |
I don't know how to write this measure :o(
Can any boby help me to write it ?
I thank you.
JC
Hi @jct999
You can use this code
Target per brand (high priority) =
SUMX (
ADDCOLUMNS (
Table1,
"@Target",
CALCULATE (
SUM ( Table1[QTY] ),
ALLEXCEPT ( Table1, Table1[COUNTRY] ),
Table1[KPI] = "TARGET"
)
),
IF (
Table1[PRIORITY] = "HIGH",
[@Target]
)
)
@jct999 , Try if this can help
Target per brand = CALCULATE (
SUM ( 'DATASET'[QTY] ),
filter( ALL ( 'DATASET'), 'DATASET'[KPI] = "TARGET" && 'DATASET'[COUNTRY] = max('DATASET'[COUNTRY]) && [PRIORITY] <> "LOW" )
)
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
24 | |
10 | |
7 | |
6 | |
6 |
User | Count |
---|---|
30 | |
11 | |
11 | |
10 | |
6 |