The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi everyone,
This may be a little complicated to explain, but I will try my best to explain it clearly.
I need to calculate the average Cost per KG (C/KG) for the year 2021. C/KG is calculated by (Value Received USD / Received KGs ).
As you can see in the picture below, the average is not calculating correctly. (12+22+22)/3 = 18.67, should not be 14.86, which is what Power BI currently shows.
These are the two items that I created to calculate the C/KG X:
C/KG = DIVIDE(MPLINE[Value Received USD],MPLINE[Received KGs],BLANK())
C/KG X = AVERAGEX(VALUES(MPLINE[ItemNrDel]),CALCULATE(AVERAGE(MPLINE[C/KG])))
Please let me know how I can fix this issue!
Best,
Grace
Hi,
Does this measure work?
C/KG new = If(hasonevalue(MPLINE[ItemNrDel]),[C/KG],AVERAGEX(VALUES(MPLINE[ItemNrDel]),[C/KG]))
Hi Ashish, thank you for your help! Unfortunately this is still givnig the same result.
I'm really lost... Please let me know if I should provide more information
Hi,
Share the download link of the PBI file. Also, show the expected result very clearly.
Assuming that you want this to be measures you need to use aggregation functions like SUM() in your code. Otherwise this will be computed on row level.
Please provide sanitized sample data that fully covers your issue. I cannot help you without usable sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive. I cannot use screenshots of your source data.
Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
User | Count |
---|---|
69 | |
66 | |
62 | |
48 | |
28 |
User | Count |
---|---|
112 | |
83 | |
66 | |
48 | |
43 |