Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi! I have this table for subscriptions to our service:
Id Subscriber | Subscription date |
210651 | 30/04/2013 |
210651 | 30/04/2013 |
210651 | 30/04/2020 |
224376 | 27/01/2020 |
224379 | 07/05/2020 |
224377 | 16/07/2020 |
224382 | 23/02/2020 |
224380 | 29/05/2020 |
224381 | 01/12/2021 |
214031 | 24/11/2021 |
214048 | 16/11/2021 |
214032 | 08/03/2021 |
214030 | 12/08/2021 |
We are not able to create this output:
Week range | Subscription 2021 (A) | Weekly variation 2021 | Subscription 2022 (B) | Weekly variation 2022 | 2021 vs 2021 (B-A)/A |
1-jan-8-jan | 3.280 | 8.387 | |||
9-jan-15-jan | 4.061 | 23,81% | 9.881 | 17,81% | 143,31% |
16-jan-22-jan | 6.916 | 70,30% | 11.884 | 20,27% | 71,83% |
23-jan-29-jan | 8.460 | 22,33% | 13.174 | 10,85% | 55,72% |
30-jan-5-feb | 9.798 | 15,82% | 13.894 | 5,47% | 41,80% |
6-feb-12-feb | 10.687 | 9,07% | 14.749 | 6,15% | 38,01% |
13-feb-19-feb | 11.331 | 6,03% | 15.475 | 4,92% | 36,57% |
20-feb-26-feb | 11.661 | 2,91% | 16.039 | 3,64% | 37,54% |
26-feb-5-mar | 11.963 | 2,59% | 16.564 | 3,27% | 38,46% |
6-mar-12-mar | 12.246 | 2,37% | 17.063 | 3,01% | 39,34% |
13-mar-19-mar | 12.493 | 2,02% | 17.504 | 2,58% | 40,11% |
20-mar-26-mar | 13.013 | 4,16% | 17.837 | 1,90% | 37,07% |
I appreciate solutions both in Query editor (creating a new table) or in DAX
Thank you
Hi @fitapbi ,
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem(Such as how to calculate the weekly variation and where does the ssubscription come from) or share me with your pbix file after removing sensitive data.
Refer to:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@fitapbi , Create a calendar like below, Join with your table , mark as date table
Date=
Var _cal = Addcolumns(calendar(date(2020,01,01), date(2021,12,31) ), "Month no" , month([date])
, "Year", year([date])
, "Month Year", format([date],"mmm-yyyy")
, "Month year sort", year([date])*100 + month([date])
, "Qtr Year", format([date],"yyyy-\QQ")
, "Qtr", quarter([date])
, "Month",FORMAT([Date],"mmmm")
, "Month sort", month([DAte])
, "Week No" , if([Date]> Date(Year([Date]),1,1) , Quotient(datediff(Date(Year([Date]),1,2) , [Date], day) ,7)+1 ,1)
, "Year Week" ,Year([Date])*100 + if([Date]> Date(Year([Date]),1,1) , Quotient(datediff(Date(Year([Date]),1,2) , [Date], day) ,7)+1 ,1)
)
return
addcolumns(_cal ,
"Week Rank" , rankx(_cal, [Year week],,asc,dense) ,
"Week Name" , format(minx(filter(_cal,[Year Week] =earlier([Year Week])),[Date]), "dd-Mmm") &" - "& format(maxx(filter(_cal,[Year Week] =earlier([Year Week])),[Date]), "dd-Mmm")
)
Then create measure like
example
This Week = CALCULATE(count(Table[Id Subscriber]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(count(Table[Id Subscriber]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
diff = [This Week] - [Last week]
diff % =divide( [This Week] - [Last week],[Last week])
Use matrix visual with week name in row, year in column , count measure and diff% measure in values
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8
User | Count |
---|---|
106 | |
89 | |
81 | |
76 | |
73 |
User | Count |
---|---|
112 | |
104 | |
96 | |
74 | |
66 |