The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi!
I have the dataset attached, and want to have the following output:
monthly, the total quantity of customers (id-cliente), categorized in:
Example of the desired output:
Any ideas of how to do it?
Tks!!
Solved! Go to Solution.
Hi @gtrani ,
According to your description, I download your dataset and here's my solution.
Create two calculated columns.
YearMonth =
YEAR ( [Data] ) & "-"
& IF ( LEN ( MONTH ( [Data] ) ) = 1, 0 & "" & MONTH ( [Data] ), MONTH ( [Data] ) )
Category =
VAR _New =
COUNTROWS (
FILTER (
'Planilha1',
'Planilha1'[id-cliente] = EARLIER ( 'Planilha1'[id-cliente] )
&& 'Planilha1'[YearMonth] < EARLIER ( 'Planilha1'[YearMonth] )
)
)
VAR _LastM =
COUNTROWS (
FILTER (
'Planilha1',
'Planilha1'[id-cliente] = EARLIER ( 'Planilha1'[id-cliente] )
&& EOMONTH ( 'Planilha1'[Data], 0 ) = EOMONTH ( EARLIER ( Planilha1[Data] ), -1 )
)
)
RETURN
IF ( _New = 0, "New", IF ( _LastM > 0, "LastM", "Before" ) )
Put YearMonth column in X-axis, Category in Y-axis and Legend, Get the result.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @gtrani ,
According to your description, I download your dataset and here's my solution.
Create two calculated columns.
YearMonth =
YEAR ( [Data] ) & "-"
& IF ( LEN ( MONTH ( [Data] ) ) = 1, 0 & "" & MONTH ( [Data] ), MONTH ( [Data] ) )
Category =
VAR _New =
COUNTROWS (
FILTER (
'Planilha1',
'Planilha1'[id-cliente] = EARLIER ( 'Planilha1'[id-cliente] )
&& 'Planilha1'[YearMonth] < EARLIER ( 'Planilha1'[YearMonth] )
)
)
VAR _LastM =
COUNTROWS (
FILTER (
'Planilha1',
'Planilha1'[id-cliente] = EARLIER ( 'Planilha1'[id-cliente] )
&& EOMONTH ( 'Planilha1'[Data], 0 ) = EOMONTH ( EARLIER ( Planilha1[Data] ), -1 )
)
)
RETURN
IF ( _New = 0, "New", IF ( _LastM > 0, "LastM", "Before" ) )
Put YearMonth column in X-axis, Category in Y-axis and Legend, Get the result.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
79 | |
72 | |
48 | |
41 |
User | Count |
---|---|
138 | |
108 | |
69 | |
64 | |
57 |