I have the following expression in Excel that works fine.
=CUBESET("ThisWorkbookDataModel",
"TopCount(
[ProductBV].[Product Name].Children,10,
sum(
(
[Calendar].[Week Ending].[All].[1/6/2013]:[Calendar].[Week Ending].[All].["&TEXT($E$2,"m/d/yyyy")&"],
[ProductBV].[Moderation Status (ALL)].[All].["&$E$3&"]
),
[Measures].[Product Review Count]
)
)",
"Top 10 to date")
The Product Review Count measure using the following DAX formula.
Product Review Count:=COUNTROWS(ProductBV)
However, when I change the DAX measure to one that utilizes an AVERAGE function (Product Avg Review), the CUBESET function does not work correctly. It still has the correct number of items in the CUBESET, but when I use CUBERANKEDMEMBER(1-10), it does not show me the top 10 Products by Average Rating.
Product Avg Review:=AVERAGE(ProductBV[Rating])
'Not working correctly' expression below:
=CUBESET("ThisWorkbookDataModel",
"TopCount(
[ProductBV].[Product Name].Children,10,
sum(
(
[Calendar].[Week Ending].[All].[1/6/2013]:[Calendar].[Week Ending].[All].["&TEXT($E$2,"m/d/yyyy")&"],
[ProductBV].[Moderation Status (ALL)].[All].["&$E$3&"]
),
[Measures].[Product Avg Review]
)
)",
"Top 10 to date")
All in all, my data is very simple. I have one data table connected to a calendar table that contains my product name, rating, date and review status.
The within my dashboard, my date ($E$2) and the review status ($E$3) can be changed by the user via a dropdown.
+-----------------+-------------------+------------+----------------+
| Submission Date | Moderation Status | Product ID | Overall Rating |
+-----------------+-------------------+------------+----------------+
| 10/23/2016 | APPROVED | Product 1 | 5 |
| 10/23/2016 | APPROVED | Product 2 | 5 |
| 10/23/2016 | APPROVED | Product 3 | 5 |
| 10/23/2016 | REJECTED | Product 3 | 3 |
| 10/23/2016 | REJECTED | Product 4 | 3 |
+-----------------+-------------------+------------+----------------+
Can anyone tell me why this is happening and how to fix it?