Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
I am using Excel PowerPivot from the tabular data model and need to do average on distinct records, although I have gone trough with many suggestions are available online, but not getting the correct output.
Sample table
| prod | qty |
| Apple | 10 |
| Apple | 15 |
| Apple | 10 |
| Organe | 5 |
| Organe | 12 |
| Organe | 12 |
| Organe | 12 |
| Banana | 8 |
| Banana | 8 |
Result I am getting
| prod | my_avg_qty_return |
| Apple | 10.22222 |
| Orange | 10.22222 |
| Banana | 10.22222 |
Result I am expecting
| prod | avg_qty_expected |
| Apple | 11.66667 |
| Orange | 10.25 |
| Banana | 8 |
Solved! Go to Solution.
Hi @zaforir2002
I think you have a confusion between a calculated column and a measure.
If you create the DAX measure:
AvgQty = Average(YourTable[Qty] ) and bring in this measure in a pivot table, you'll get the correct result thanks to filter context.
Hi @zaforir2002
I think you have a confusion between a calculated column and a measure.
If you create the DAX measure:
AvgQty = Average(YourTable[Qty] ) and bring in this measure in a pivot table, you'll get the correct result thanks to filter context.
Thanks, @Datatouille,
I have used it in a measure, not in the calculated column, but the results are same for each prod :(.
Do you have everything in the same table or do you bring in products from another table ?
In that case, you need to create a (1 to Many) Relationship between Products and your Quantity Table.
All is from same table @Datatouille
Will you please share the file ? because it should work !
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 37 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 25 |