Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello dear community.
Tengo la siguiente tabla en un csv, è incluso ya la tengo cargada en el Power BI.
+----------+----------+-----+
| fecha • msisdn • MAU •
+----------+----------+-----+
| 1-Jan-23 | 88880000 | 1 |
| 1-Jan-23 | 88880001 | 1 |
| 1-Jan-23 | 88880002 | 1 |
| 1-Jan-23 | 88880003 | 1 |
| 1-Feb-23 | 88880002 | 1 |
| 1-Feb-23 | 88880003 | 1 |
| 1-Feb-23 | 88880000 | 1 |
| 1-Mar-23 | 88880001 | 1 |
| 1-Mar-23 | 88880002 | 1 |
| 1-Mar-23 | 88880003 | 1 |
| 1-Mar-23 | 88880004 | 1 |
| 1-Mar-23 | 88880005 | 1 |
| 1-Apr-23 | 88880001 | 1 |
| 1-Apr-23 | 88880003 | 1 |
| 1-Apr-23 | 88880004 | 1 |
| 1-Apr-23 | 88880005 | 1 |
| 1-Apr-23 | 88880006 | 1 |
| 1-Apr-23 | 88880007 | 1 |
| 1-Apr-23 | 88880008 | 1 |
| 1-May-23 | 88880000 | 1 |
| 1-May-23 | 88880001 | 1 |
| 1-May-23 | 88880002 | 1 |
| 1-May-23 | 88880003 | 1 |
| 1-May-23 | 88880004 | 1 |
| 1-May-23 | 88880008 | 1 |
| 1-Jun-23 | 88880001 | 1 |
| 1-Jun-23 | 88880002 | 1 |
| 1-Jun-23 | 88880005 | 1 |
| 1-Jun-23 | 88880006 | 1 |
| 1-Jun-23 | 88880007 | 1 |
| 1-Jun-23 | 88880008 | 1 |
| 1-Jul-23 | 88880001 | 1 |
| 1-Jul-23 | 88880003 | 1 |
| 1-Jul-23 | 88880004 | 1 |
| 1-Jul-23 | 88880005 | 1 |
| 1-Jul-23 | 88880009 | 1 |
| 1-Jul-23 | 88880010 | 1 |
| 1-Jul-23 | 88880012 | 1 |
| 1-Aug-23 | 88880002 | 1 |
| 1-Aug-23 | 88880003 | 1 |
| 1-Aug-23 | 88880004 | 1 |
| 1-Aug-23 | 88880005 | 1 |
| 1-Aug-23 | 88880009 | 1 |
| 1-Aug-23 | 88880010 | 1 |
+----------+----------+-----+
This table contains information on numbers of unique phones (in the table this phone number is called [msisdn]) per month consisting of 01-Jan-2023 to 1-Aug-2023. In each month the phone number is unique, it is not repeated.
If you can see for example in the example table that I have provided, the phone number '88880001' appears 6 times from Jan-23 to Aug-23, 1 time in each month.
However, as a final result, I want to create a report in Power BI where the overall unique numbers appear with a new column called "[recurrence]". This new column has to be created in Power BI, either in DAX language or in M language. This column must be generated according to the following logics or conditions:
- if the sum of the [mau] from "1-Mar-2023" to "1-Jul-2023" = 5, then put "recurring",
- if the sum of the [mau] from "1-Mar-2023" to "1-Jul-2023" = 3 or 4, then put "casual",
- otherwise, if the sum of the [mau] from "1-Mar-2023" to "1-Jul-2023" < 3, then put "new".
Based on the example table, this would be the result I hope to get:
+----------+------------+------------------+
| MSISDN | Cant times | Recurrence type |
+----------+------------+------------------+
| 88880000 | 1 | New |
| 88880001 | 5 | Recurring |
| 88880002 | 3 | Casual |
| 88880003 | 4 | Casual |
| 88880004 | 4 | Casual |
| 88880005 | 4 | Casual |
| 88880006 | 2 | New |
| 88880007 | 2 | New |
| 88880008 | 3 | Casual |
| 88880009 | 1 | New |
| 88880010 | 1 | New |
| 88880012 | 1 | New |
+----------+------------+------------------+
That is, although the data consists of 01-Jan to 01-Aug, I only need to make this evaluation based on 5 months from Mar-23 to Jul-23.
Here is the link where you can download the sample dataset and the expected result. I really appreciate you can help me with this solution:
Solved! Go to Solution.
Hi, @Syndicate_Admin
You can try the following methods.
Column:
Count = CALCULATE(COUNT('Table'[msisdn]),
FILTER('Table',[fecha]>=DATE(2023,3,1)
&&[fecha]<=DATE(2023,7,1)
&&[msisdn]=EARLIER('Table'[msisdn])))Recurrence type = SWITCH(TRUE(),
[Count]=5,"Recurring",
[Count]=4||[Count]=3,"casual",
[Count]<3,"new")
Measure:
From = MINX(FILTER('Table',[Recurrence type]=SELECTEDVALUE('Table'[Recurrence type])),[Count])To = Var _Max=MAXX(FILTER('Table',[Recurrence type]=SELECTEDVALUE('Table'[Recurrence type])),[Count])
Return
IF([From]=_Max,BLANK(),_Max)
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Syndicate_Admin
You can try the following methods.
Column:
Count = CALCULATE(COUNT('Table'[msisdn]),
FILTER('Table',[fecha]>=DATE(2023,3,1)
&&[fecha]<=DATE(2023,7,1)
&&[msisdn]=EARLIER('Table'[msisdn])))Recurrence type = SWITCH(TRUE(),
[Count]=5,"Recurring",
[Count]=4||[Count]=3,"casual",
[Count]<3,"new")
Measure:
From = MINX(FILTER('Table',[Recurrence type]=SELECTEDVALUE('Table'[Recurrence type])),[Count])To = Var _Max=MAXX(FILTER('Table',[Recurrence type]=SELECTEDVALUE('Table'[Recurrence type])),[Count])
Return
IF([From]=_Max,BLANK(),_Max)
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 43 | |
| 39 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 63 | |
| 32 | |
| 30 | |
| 23 |