Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I have a problem to write a DAX formula which normalizes invoice data:
I have data on the products that were ordered and the products that were received instead ( when the substitute is empty, it means that there was no substitute.
Can someone help me with a Dax formula, which shows the most substituted products in a normalized way. (like under the yellow bar)
Thank you very much in advance!
Kind regards,
B.
Solved! Go to Solution.
Hi @ase
I'm not totally sure what you mean by normalized, but here's some measures to help you out. These give you numbers, so can be used in charts.
Order Count = COUNTROWS('Table')
Substituted Order Count = SUM('Table'[Is substituted])
Substituted Percent = DIVIDE([Substituted Order Count], [Order Count])
if you want the specific text in your example then we can have measures to build that text up.
Text 1 =
VAR _Product = SELECTEDVALUE('Table'[Ordered product], "Multiple products")
VAR _Result =
_Product & " " & [Order Count] & " orders total, " & [Substituted Order Count] & " substituted"
RETURN
_Result
Text 2 =
VAR _Product = SELECTEDVALUE('Table'[Ordered product], "Multiple products")
VAR _Result =
_Product & " " & FORMAT([Substituted Percent] * 100, "#,0") & "% substituted"
RETURN
_Result
Hi @PaulOlding
The idea was to show that in XX% of the cases, apples were substituted with another product.
The rationale for normalization part comes from the fact that for example we might have ordered 10 apples and 9 of them might have been substituted, and at the same time we might have ordered 1000 oranges, with 350 substituted, so I need to factor for the amount of the products.
Unfortunately your solution only gives the number of substitutuions, but not the normalized ratio between ordered apples and times they were substituted.
Kind regards,
B.
Hi @ase
I'm not totally sure what you mean by normalized, but here's some measures to help you out. These give you numbers, so can be used in charts.
Order Count = COUNTROWS('Table')
Substituted Order Count = SUM('Table'[Is substituted])
Substituted Percent = DIVIDE([Substituted Order Count], [Order Count])
if you want the specific text in your example then we can have measures to build that text up.
Text 1 =
VAR _Product = SELECTEDVALUE('Table'[Ordered product], "Multiple products")
VAR _Result =
_Product & " " & [Order Count] & " orders total, " & [Substituted Order Count] & " substituted"
RETURN
_Result
Text 2 =
VAR _Product = SELECTEDVALUE('Table'[Ordered product], "Multiple products")
VAR _Result =
_Product & " " & FORMAT([Substituted Percent] * 100, "#,0") & "% substituted"
RETURN
_Result
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
7 | |
6 |
User | Count |
---|---|
15 | |
13 | |
11 | |
9 | |
8 |