Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
Hi Experts,
I have the following sample data:
Order Id | Line Id | Quantity | Unit Price |
12345 | 1 | 4 | 10 |
12345 | 2 | 3 | 11 |
54321 | 1 | 8 | 4 |
54321 | 2 | 5 | 9 |
54321 | 2 | 7 | 0 |
I need to create Revenue where Revenue = Quantity * Unit Price
In case of Unit Price = 0, Revenue will be equal to product of sum of quantity and non zero "Unit Price" for the corresponding "Order Id" and "Line Id".
In my report I need to show only "Order Id" ,"Quantity" and "Revenue", the data should be as below in "Table" visual:
Order Id | Quantity | Revenue |
12345 | 7 | 73 |
54321 | 20 | 140 |
Calculation needed for "Order Id": 12345 = (4*10) +(3*11)= 73
Calculation needed for "Order Id": 54321 = (8*4) +((5+7)*9)= 140
Here for "Order Id": 54321, as shown above,Revenue will be equal to product of sum of quantity and non zero "Unit Price" for the corresponding "Line Id".
Can you please suggest how we can achieve this requirement.
Solved! Go to Solution.
Hi @TusharGaurav - create a DAX measure that handles the logic to sum quantities and apply the non-zero unit price when necessary.
you can replace with your table name:
Ouput:
Hope this works
Proud to be a Super User! | |
Hi @TusharGaurav - create a DAX measure that handles the logic to sum quantities and apply the non-zero unit price when necessary.
you can replace with your table name:
Ouput:
Hope this works
Proud to be a Super User! | |
Hi Rajendra,
Thanks a lot for your help.
It worked 🙂
Thanks and Regards,
Tushar Gaurav
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
77 | |
73 | |
71 | |
45 | |
42 |
User | Count |
---|---|
48 | |
47 | |
29 | |
28 | |
28 |