Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
To simplify I need to use the Max formula as Max(1,2,3) where it returns 3. But it is not possible, so is there is a way around it. So I have sales in a column and day name in the other. I need the day with the highest total sales. Here is the way I tried to achieve it:
Best Day =
Var Sun = CALCULATE(SUM('Sales (2)'[Sales]), 'Dax Calendar'[Day Name] = "Sunday")
Var Mon = CALCULATE(SUM('Sales (2)'[Sales]), 'Dax Calendar'[Day Name] = "Monday")
Var Tues = CALCULATE(SUM('Sales (2)'[Sales]), 'Dax Calendar'[Day Name] = "Tuesday")
Var Wed = CALCULATE(SUM('Sales (2)'[Sales]), 'Dax Calendar'[Day Name] = "Wednesday")
Var Thurs = CALCULATE(SUM('Sales (2)'[Sales]), 'Dax Calendar'[Day Name] = "Thursday")
Var Fri = CALCULATE(SUM('Sales (2)'[Sales]), 'Dax Calendar'[Day Name] = "Friday")
Var Sat = CALCULATE(SUM('Sales (2)'[Sales]), 'Dax Calendar'[Day Name] = "Saturday")
RETURN
MAX(Sun,Mon,Tues,Wed,Thurs,Fri,Sat)
Solved! Go to Solution.
Hi @Saud_Jilani
You can create 2 measures :
1 for highest sales :
Pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Hi @Saud_Jilani
For the highest second day, you can use these formulas :
The updated pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Hi @Saud_Jilani
You can create 2 measures :
1 for highest sales :
Pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Thanks @Ritaf1983 , its perfect.
Any idea on how to get the 2nd best day as well?
Hi @Saud_Jilani
For the highest second day, you can use these formulas :
The updated pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Hi @Saud_Jilani - create below measure to calculate the highest total sales, I hope you have a day name column in your dataset.
Measure:
Best Day Sales =
MAXX(
VALUES('DaySales'[Day Name]), -- Iterate over each unique day name
CALCULATE(SUM('DaySales'[Total Sales])) -- Calculate total sales for each day
)
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
Thanks, @rajendraongole1, it works well.
How can modify it to result as:
The Highest day is "x" with the sales"$x" and the 2nd highest day is "y" with the sales "$y" .
By "$x" I refer the amount, and "x" refers to the corresponding day.
User | Count |
---|---|
117 | |
74 | |
62 | |
50 | |
45 |
User | Count |
---|---|
174 | |
125 | |
60 | |
60 | |
57 |