Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi Experts,
I have this sales table, with Date, Sold Product(Quantity), UserID and ProductID.
Date Sold Product UserId ProductID
----- -------------- ------- -----------
2019-01-01 10 1 1
2019-01-01 15 1 2
2019-01-01 5 2 1
2019-01-05 10 1 1
2019-01-05 3 2 1
2019-01-05 3 2 2
2019-01-10 20 1 2
And I would like to show a table with UserId ,the maximum Sales (regardless of the ProductID) and the date of MaxSales, like this:
UserID MaxSales Date Of MaxSales
------- -------------------- ----------------------------
1 25 2019-01-01
2 6 2019-01-05
First I created a measure called TotalSold to calculate the Sum of Sold Product:
Then I created a masure called MaxSales to calculate the max of TotalSold
But Im not able to calculate the date related to the MaxSales, could you please help me!
Here I attach a onedrive link that contains the pbix file:
Thanks.
Solved! Go to Solution.
Hi @Anonymous
You can download the pbix file here.
Actually you have to add one more measure for the date.
MaxSaleDate = CALCULATE(FIRSTDATE(DimDate[Date]), FILTER(VALUES(DimDate[Date]), [TotalSold]= CALCULATE([MaxSale], VALUES(DimDate[Date]))) )
If this helped you, please mark this post as an accepted solution and like to give KUDOS .
Regards,
Affan
Hi @Anonymous
You can download the pbix file here.
Actually you have to add one more measure for the date.
MaxSaleDate = CALCULATE(FIRSTDATE(DimDate[Date]), FILTER(VALUES(DimDate[Date]), [TotalSold]= CALCULATE([MaxSale], VALUES(DimDate[Date]))) )
If this helped you, please mark this post as an accepted solution and like to give KUDOS .
Regards,
Affan
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |