Forum Discussion
Trouble with a measure
Hey fellow users of Power Bi,
I am in the making of a Power Bi report, actually trying to convert a rather complicated Qlikview report to a Power Bi report, but I have quite some struggles, a few more than I can simply try to explain here, therefor I am seeking a friendly person who has knowledge with Power Bi along with Qlikview and is up for a lil chat where I can try to explain some of my struggles and perhaps bounce a few ideas with.
Best regards Henrik V
Skype: Snaske2
- Shamatix8 years ago
Post Partisan
Guess no one had the time sadly.
Well ill try to describe one of my issues:
I am making a table with a ton of invoice data and of course some of the invoices has multiple lineitems which can be seen on the right table of the two below.
I have done some tests but I cant seem to be able to achieve the result I want to.
If you take a look at the left table the Column Test2 and Test3 are actually bring me the correct "Moms grundlag" as its giving me the average of the invoice which is what I want, but the "Total" at the bottom still gives me the total of all the lines, it aint giving me the sum of all the averages pr invoice which is what I want. In the left table I want the total to be 68,902,632, not 175.407.896.
Below you will be able to see the measures I have been trying to fiddle around with:
Test1 = If(HASONEVALUE(Indfortoldning[Løbenummer]),CALCULATE(SUM(Indfortoldning[Moms grundlag])),sumx(Indfortoldning,CALCULATE(AVERAGE(Indfortoldning[Moms grundlag])))) - THIS ONE IS COMPLETELY INCORRECT
Test2 = If(HASONEVALUE(Indfortoldning[Løbenummer]),CALCULATE(AVERAGE(Indfortoldning[Moms grundlag])),sumx(Indfortoldning,CALCULATE(AVERAGE(Indfortoldning[Moms grundlag])))) - This one seems to give almost the correct result, but the total at the bottom is still incorrect
Test3 = If(HASONEVALUE(Indfortoldning[Løbenummer]),CALCULATE(AVERAGE(Indfortoldning[Moms grundlag])),sumx(Indfortoldning,CALCULATE(SUM(Indfortoldning[Moms grundlag])))) - This one seems to give almost the correct result, but the total at the bottom is still incorrect
I hope you understand my issue and are able to help, otherwise feel free to ask :)
- Shamatix8 years ago
Post Partisan
Really no one knows the answer :S?
Or simply do not understand my question?
- stretcharm8 years ago
Memorable Member
I create a small test data set and these measures worked for me.
AvgMeasure = CALCULATE(AVERAGE(InvoiceLines[Amount]))
SumAvg = sumx(Invoices, [AvgMeasure])
The worked if I have one or more Invoice Items.
I have an invoice table and an Invoice Line Table joined on Invoice ID.