Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
hello, i have a table in which for each day i have the Sales % for each product, something like:
Date | Product | Sale for that day for that product | % Sale for that day for that product from total sales for that day|
I want to make a formula, in a column which return 3 values for each day, for each product, if the product sale Procent is in the top 70% the value should be tier1, is it is in the 70% from the last 30% from total it would say tier2 and blank for the rest
something like that.
Thank you
day | product | sales that day | total sales that day | %from total | Tier |
01.01.2023 | Product05 | 30 | 116 | 0.25862069 | Tier1 |
01.01.2023 | Product07 | 27 | 116 | 0.232758621 | Tier1 |
01.01.2023 | Product01 | 11 | 116 | 0.094827586 | Tier1 |
01.01.2023 | Product09 | 11 | 116 | 0.094827586 | Tier1 |
01.01.2023 | Product10 | 9 | 116 | 0.077586207 | Tier2 |
01.01.2023 | Product11 | 7 | 116 | 0.060344828 | Tier2 |
01.01.2023 | Product08 | 5 | 116 | 0.043103448 | Tier2 |
01.01.2023 | Product03 | 5 | 116 | 0.043103448 | |
01.01.2023 | Product06 | 5 | 116 | 0.043103448 | |
01.01.2023 | Product04 | 4 | 116 | 0.034482759 | |
01.01.2023 | Product02 | 2 | 116 | 0.017241379 | |
01.02.2023 | Product04 | 20 | 84 | 0.238095238 | Tier1 |
01.02.2023 | Product08 | 18 | 84 | 0.214285714 | Tier1 |
01.02.2023 | Product10 | 14 | 84 | 0.166666667 | Tier1 |
01.02.2023 | Product11 | 6 | 84 | 0.071428571 | Tier1 |
01.02.2023 | Product09 | 5 | 84 | 0.05952381 | Tier2 |
01.02.2023 | Product02 | 5 | 84 | 0.05952381 | Tier2 |
01.02.2023 | Product01 | 5 | 84 | 0.05952381 | Tier2 |
01.02.2023 | Product05 | 4 | 84 | 0.047619048 | |
01.02.2023 | Product03 | 3 | 84 | 0.035714286 | |
01.02.2023 | Product06 | 3 | 84 | 0.035714286 | |
01.02.2023 | Product07 | 1 | 84 | 0.011904762 | |
01.03.2023 | Product08 | 26 | 129 | 0.201550388 | Tier1 |
01.03.2023 | Product06 | 25 | 129 | 0.19379845 | Tier1 |
01.03.2023 | Product09 | 14 | 129 | 0.108527132 | Tier1 |
01.03.2023 | Product11 | 12 | 129 | 0.093023256 | Tier1 |
01.03.2023 | Product01 | 12 | 129 | 0.093023256 | Tier1 |
01.03.2023 | Product05 | 11 | 129 | 0.085271318 | Tier2 |
01.03.2023 | Product10 | 11 | 129 | 0.085271318 | Tier2 |
01.03.2023 | Product02 | 9 | 129 | 0.069767442 | |
01.03.2023 | Product04 | 5 | 129 | 0.03875969 | |
01.03.2023 | Product03 | 3 | 129 | 0.023255814 | |
01.03.2023 | Product07 | 1 | 129 | 0.007751938 |
Solved! Go to Solution.
Hi @cristianj ,
I created a sample pbix file(see the attachment), please find the details in it.
By measures:
rank =
VAR _seldate =
SELECTEDVALUE ( 'Table'[day] )
RETURN
RANKX (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[day] = _seldate ),
CALCULATE ( MAX ( 'Table'[%from total] ) ),
,
DESC,
DENSE
)
Tier =
VAR _seldate =
SELECTEDVALUE ( 'Table'[day] )
VAR _maxrank =
MAXX ( FILTER ( ALLSELECTED ( 'Table' ), 'Table'[day] = _seldate ), [rank] )
VAR _70perrank =
ROUND ( _maxrank * 0.7, 0 )
RETURN
IF (
[rank] <= _70perrank,
IF ( [rank] <= _70perrank * 0.7, "Tier1", "Tier2" ),
BLANK ()
)
By calculated columns:
Column =
RANKX (
FILTER ( 'Table', 'Table'[day] = EARLIER ( 'Table'[day] ) ),
'Table'[%from total],
,
DESC,
DENSE
)
Column 2 =
VAR _maxrank =
MAXX ( FILTER ( 'Table', 'Table'[day] = EARLIER ( 'Table'[day] ) ), [Column] )
VAR _70perrank =
ROUND ( _maxrank * 0.7, 0 )
RETURN
IF (
[Column] <= _70perrank,
IF ( [Column] <= _70perrank * 0.7, "Tier1", "Tier2" ),
BLANK ()
)
Best Regards
Hi @cristianj ,
I created a sample pbix file(see the attachment), please find the details in it.
By measures:
rank =
VAR _seldate =
SELECTEDVALUE ( 'Table'[day] )
RETURN
RANKX (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[day] = _seldate ),
CALCULATE ( MAX ( 'Table'[%from total] ) ),
,
DESC,
DENSE
)
Tier =
VAR _seldate =
SELECTEDVALUE ( 'Table'[day] )
VAR _maxrank =
MAXX ( FILTER ( ALLSELECTED ( 'Table' ), 'Table'[day] = _seldate ), [rank] )
VAR _70perrank =
ROUND ( _maxrank * 0.7, 0 )
RETURN
IF (
[rank] <= _70perrank,
IF ( [rank] <= _70perrank * 0.7, "Tier1", "Tier2" ),
BLANK ()
)
By calculated columns:
Column =
RANKX (
FILTER ( 'Table', 'Table'[day] = EARLIER ( 'Table'[day] ) ),
'Table'[%from total],
,
DESC,
DENSE
)
Column 2 =
VAR _maxrank =
MAXX ( FILTER ( 'Table', 'Table'[day] = EARLIER ( 'Table'[day] ) ), [Column] )
VAR _70perrank =
ROUND ( _maxrank * 0.7, 0 )
RETURN
IF (
[Column] <= _70perrank,
IF ( [Column] <= _70perrank * 0.7, "Tier1", "Tier2" ),
BLANK ()
)
Best Regards
User | Count |
---|---|
121 | |
69 | |
66 | |
56 | |
52 |
User | Count |
---|---|
181 | |
85 | |
67 | |
61 | |
53 |