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.
I have a table (attached herewith), which contains sales by customer by month.
I want to split the sales for every month, by customers who are new in that month and by returning customers.
I have seen a few video lessons on the internet, but none of them seem to solving the problem.
Basically, if a customer name, in a given month, has occured more than once, before the current month and has a non-blank sales value, then he is a returning customer, else he is a new customer for the month
So if I can generate a column which can flag off the customer name as "new" or "repeat" - that should solve the problem I guess
I have probably got the logic right but not able to dax it into a measure or a column.
Any help appreciated
Date | CUSTOMER NAME | Units sold |
31-03-2022 | TUNGA PARADISE | 500 |
31-03-2022 | Ambassator Pallava | 500 |
31-03-2022 | Zone The Park | 500 |
31-03-2022 | Beverly | 500 |
31-03-2022 | Gokulam Park | 500 |
31-03-2022 | Holiday Express | 500 |
31-03-2022 | Raj Park | 500 |
31-03-2022 | Vestin Park | 500 |
31-03-2022 | Vijay Park | 500 |
31-03-2022 | Shelter | 500 |
31-03-2022 | Fairfield Marriott | 500 |
31-03-2022 | Fairfield Marriott | 500 |
31-03-2022 | MGM Healthcare | 500 |
31-03-2022 | Empire Agencies | 500 |
31-03-2022 | Ideal Beach | 500 |
31-03-2022 | Green Meadows | 500 |
31-03-2022 | Hot Chips | 500 |
31-03-2022 | Park Plaza | 500 |
31-03-2022 | Wellsell Foods | 500 |
31-03-2022 | Fortune Pandiyan | 500 |
31-03-2022 | Surya Chandra Enterprises | 500 |
31-03-2022 | RNVN Enterprises | 500 |
31-03-2022 | HOTEL TAZZ ODISHA | 500 |
30-04-2022 | Ambassator Pallava | 500 |
30-04-2022 | Beverly | 500 |
30-04-2022 | Gokulam Park | 500 |
30-04-2022 | Holiday Express | 500 |
30-04-2022 | Raj Park | 500 |
30-04-2022 | Vijay Park | 500 |
30-04-2022 | Shelter | 500 |
30-04-2022 | Fairfield Marriott | 500 |
30-04-2022 | Ideal Beach | 500 |
30-04-2022 | Poppy`s Tower | 500 |
30-04-2022 | Sterling | 500 |
30-04-2022 | GREENWOODS HOSPITALITY PVT LTD | 500 |
Solved! Go to Solution.
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
It is for creating a calculated column.
You can add some more logics into the Calculated Column, if it is needed.
Flag CC =
VAR _currentcustomer = Data[CUSTOMER NAME]
VAR _lastdateofpreviousmonth =
EOMONTH ( Data[Date], -1 )
VAR _previousmonthtablecurrentcustomer =
FILTER (
Data,
Data[CUSTOMER NAME] = _currentcustomer
&& Data[Date] <= _lastdateofpreviousmonth
&& Data[Units sold] <> BLANK ()
)
RETURN
IF ( COUNTROWS ( _previousmonthtablecurrentcustomer ) >= 1, "Repeat", "New" )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
It is for creating a calculated column.
You can add some more logics into the Calculated Column, if it is needed.
Flag CC =
VAR _currentcustomer = Data[CUSTOMER NAME]
VAR _lastdateofpreviousmonth =
EOMONTH ( Data[Date], -1 )
VAR _previousmonthtablecurrentcustomer =
FILTER (
Data,
Data[CUSTOMER NAME] = _currentcustomer
&& Data[Date] <= _lastdateofpreviousmonth
&& Data[Units sold] <> BLANK ()
)
RETURN
IF ( COUNTROWS ( _previousmonthtablecurrentcustomer ) >= 1, "Repeat", "New" )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
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 |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |