Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
AshDil
Helper V
Helper V

How to show Sales made by returning Customer each time

Hi,

 

I have data as follows:

AshDil_0-1628125656797.png

I want to show sale made by the customer each time.

Please help me to do.

Thanks,

AshDil

1 ACCEPTED SOLUTION

@AshDil 

maybe you can try to create a new column

Sales time = 
var _1=CALCULATE(min('Table'[Date]),ALLEXCEPT('Table','Table'[Cust_ID]))
VAR _2=minx(FILTER(all('Table'),'Table'[Cust_ID]=EARLIER('Table'[Cust_ID])&&'Table'[Date]>_1),'Table'[Date])
VAR _3=minx(FILTER('Table','Table'[Cust_ID]=EARLIER('Table'[Cust_ID])&&'Table'[Date]>_2),'Table'[Date])
VAR _4=minx(FILTER('Table','Table'[Cust_ID]=EARLIER('Table'[Cust_ID])&&'Table'[Date]>_3),'Table'[Date])
return SWITCH('Table'[Date],_1,"Sale 1",_2,"Sale 2",_3,"Sale 3",_4,"Sale 4")

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Share data in a form that can be pasted in MS Excel.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

@AshDil 

what's the expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @ryan_mayu ,

I want the output as follows:

AshDil_1-1628128258262.png

Please help me to do.

Thanks,

AshDil.

@AshDil 

maybe you can try to create a new column

Sales time = 
var _1=CALCULATE(min('Table'[Date]),ALLEXCEPT('Table','Table'[Cust_ID]))
VAR _2=minx(FILTER(all('Table'),'Table'[Cust_ID]=EARLIER('Table'[Cust_ID])&&'Table'[Date]>_1),'Table'[Date])
VAR _3=minx(FILTER('Table','Table'[Cust_ID]=EARLIER('Table'[Cust_ID])&&'Table'[Date]>_2),'Table'[Date])
VAR _4=minx(FILTER('Table','Table'[Cust_ID]=EARLIER('Table'[Cust_ID])&&'Table'[Date]>_3),'Table'[Date])
return SWITCH('Table'[Date],_1,"Sale 1",_2,"Sale 2",_3,"Sale 3",_4,"Sale 4")

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @ryan_mayu ,

 

Thank you so much for your solution. It helped me.

 

Thanks,

AshDil

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.