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,
I want to compare same period last month data by weekday. I have monthly and daily distribution data. So if i select any month, it is showing day wise data according to this month. now, i want to compare may with previous month. so, for that i have written following formula,
Same Period Last Month = CALCULATE(SUM('All Web Site Data'[New Users]), DATEADD('Date Table'[Date],-1,MONTH) )
if i want to compare monthly total of selected month and its previous month, then it showing the correct figure. But, the problem arise when i use this measure for comparing the day wise total of selected month and it's previous month. Suppose, I have selected May. So the previous month April's day wise data are
Day Total
Mon 662
Tues 936
Wed 687
Thurs 694
Fri 633
Sat 495
Sun 489
But, when i use that above formula "Same period Last month" with week day name it showing wrong figure, instead of showing above April's daily data.
Please see the below screenshots for better understand.
it seems that my "Same period last month" formula is not working with day name. I have written another formula, which is like that,
same period last month 2 = CALCULATE('All Web Site Data'[Total new user],PREVIOUSMONTH('Date Table'[Date]))
but, did not workout.
can you please identify why it is not working.
Any suggestion and advice is really appreciable.
Thanks,
snandy2011
Same Period Last Month = CALCULATE ( SUM ( 'All Web Site Data'[New Users] ), MONTH('Date Table'[Date]) = MONTH(DATEADD ( 'Date Table'[Date], -1, MONTH )) )
hi @Anonymous,
Thanks for your reply. But, your formula is not working.It is showing the following error,
"A function 'DATEADD' has been used in a True/False expression that is used as a table filter expression. This is not allowed.".
I did a little tweak, put the filter function on that. But it shows nothing,
CALCULATE (
SUM ( 'All Web Site Data'[New Users] ),FILTER('Date Table',
MONTH('Date Table'[Date]) = MONTH(DATEADD ( 'Date Table'[Date], -1, MONTH ))
) )
Do you have any other idea regarding that?
Sorry sir,
It not working again.. It ahowing the error of
"cannot convert value month of type to type text"
I have used 'date table'[month name] instead of [Month]. Because I have column in date table named moth name.
I also tried with date value function instead of selected value.. But it shows nothing.
It's ok.. I am going through with your solution. If it does not works. I will let you know..
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 |