This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi all,
I hope you are all doing well. I have a very common SalesTable (fact table) that has a ProductID column. To calculate distinct product sold, I am using following Dax.
Unique Product Sold = DistinctCount(SalesData[ProductID]) and I am getting following results in my matrix table
| Jan 2023 | Feb 2023 | Mar 2023 | Total |
| 1,725 | 3,823 | 4,299 | 4,989 |
So the unique product sold for Jan, Feb and March is 1725, 3823, 4299 respectively but the unique product sold in Quarter 1 is 4,989. I want to show averages in the Total column, that is (1725+3823+4,299)/3 = 3282.33.
I applied the new DAX Average = Divide(DistinctCount(SalesData[ProductID], DistinctCount(dimDate[MonthInCalendar]), but the result I am getting is 1663, that is 4989 (Unique product sold in Q1)/ 3 (DistinctMonth)
| Jan 2023 | Feb 2023 | Mar 2023 | Total |
| 1,725 | 3,823 | 4,299 | 1,663 |
I can see why it is doing that but I can't seem to be able to calculate the averages the way I want.
Is there a way I can achieve following result:
| Jan 2023 | Feb 2023 | Mar 2023 | Total |
| 1,725 | 3,823 | 4,299 | 3,282 |
Please let me know if I have been unclear.
Thanks in advance.
Shekhar
Solved! Go to Solution.
@shekhar_shres This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149
The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.
@shekhar_shres This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149
The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 9 | |
| 8 | |
| 6 | |
| 6 | |
| 5 |