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.
I would like to do a formula.
If I select a certain month in the filter, then it will provide the sum of sales during that month.
However, If i select all months in the filter, I want to get the result of all months divided by 12.
How can I get the result for the both scenarios depending on what I select on the months filter?
Thanks,
Youssef
Solved! Go to Solution.
No, you don't need calculate here.
Average ACV = AVERAGEX(DISTINCT('P&L Data'[Month]),sum('P&L Data'[ACV]))
Proud to be a Super User!
Hi @youssefm9
You can create a measure like this:
_average = var a=CALCULATE(COUNTAX(DISTINCT('Table'[Month]),[Month]),ALLSELECTED('Table'))
return SUMX(ALLSELECTED('Table'),[Value])/a
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You can create a measure like this one, which will give the average of all months selected.
Monthly Avg = AVERAGEX(DISTINCT(Table[MonthColumn]), [YourMeasure])
Pat
It is not what i am asking for.
What I am asking for is, if any month is selected, then give me the total. If no month is selected (thus all months selected together), give the the total divided by 12.
Did you try the measure to see if it works? If 1 month selected it will give you the total for that month. If >1 month selected (or all selected), it will give you the average total. Note that a measure is needed (not just SUM, unless it is wrapped in CALCULATE).
Pat
Ok, then to be more strict:
OR
do you want:
* if month is no filtered - give me sum of some value
* if month is filtered - give me sum of some value for selected month divided by count of selected month?
Proud to be a Super User!
Hey thank you for the reply !
I would go for: * if month is filtered - give me sum of some value for selected month divided by count of selected month?
In that case @ppm1 gave you correct answer. For one month it will return the value of this month, but for two it will return the sum of them and divided by 2, which is basicly an average. 🙂
Monthly Avg = AVERAGEX(DISTINCT(Table[MonthColumn]), SUM([Some Value]))
Proud to be a Super User!
Hello...
Thank you for the reply.
However it is not working from my side. It works if I select one month only. If I select more than one month, it will do sum.
Below is the formula i am using:
Can you post here an example data to see your issue?
Proud to be a Super User!
No, you don't need calculate here.
Average ACV = AVERAGEX(DISTINCT('P&L Data'[Month]),sum('P&L Data'[ACV]))
Proud to be a Super User!
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |