Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello,
I am looking to get the number of activities and the average cost for the last month.
I have the table [Test] data, structured as follows:
Activity_Id Date Cost
234 06/03/2019 $2300
237 06/05/2019 $4098
255 06/22/2019 $2300
405 07/15/2019 $2600
701 07/18/2019 $1346
I am in July (month 7) and I am looking to get :
Month Activity # Avg. Cost
June 3 $2899
Using the formula
CALCULATE(DISTINCTCOUNT(Test[Activity_Id]),PREVIOUSMONTH(Test[Date]))returns blank!
Solved! Go to Solution.
Hi,
You may download my PBI file from here.
Hope this helps.
You are welcome. Try this - https://www.c-sharpcorner.com/article/sort-by-month-name-in-power-bi/
Hi,
You may download my PBI file from here.
Hope this helps.
Thank you and sorry for the late reply.
Is there a way to display in the Slicer the list of months in their natural order : January, February, March, ... December?
The slicer lists them in alphabetical order.
Thank you
You are welcome. Try this - https://www.c-sharpcorner.com/article/sort-by-month-name-in-power-bi/
Thanks, it works like a charm
You are welcome.
Hi abalgir,
It seems that you want to calculate previous month and show in current month, right? If so, you could try below measures to see whether it works or not
Measure = CALCULATE ( AVERAGE ( test[Cost] ), FILTER ( ALL ( test ), YEAR ( test[date] ) = YEAR ( MIN ( test[date] ) ) && MONTH ( test[date] ) = MONTH ( MIN ( test[date] ) ) - 1 ) )
act = CALCULATE ( DISTINCTCOUNT ( test[Activity_Id ] ), FILTER ( ALL ( test ), YEAR ( test[date] ) = YEAR ( MIN ( test[date] ) ) && MONTH ( test[date] ) = MONTH ( MIN ( test[date] ) ) - 1 ) )
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
120 | |
101 | |
71 | |
61 |