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
Anonymous
Not applicable

Finding Conversion in last 360 days -

Hello Communnity, 

Happy new year !

 

Can you pplease help me writing this DAX formula :

 

I've  to find conversion from  NF customers to Fin Customer in last 360 days, when customer has aquired Financial product in calendar year.  I looking to create column for it.  

 

For Example,  if customer has aquired Financial product on 15,Feb 2021 then Code check  last 360 days to find if he had NF product.  If customer had NF product then mark it "Y".

 

I am badly stuck in writng DAX formula, so  would be grateful for any  suggestions. 

Chana

 

IDProduct    Financial Product Aquired (Calendar Year )      Transaction Date        Conversion (NF-> F)
1NFN5-May-20 
1FY6-Feb-21Y
2NFN3-Apr-20 
2NFN1-Jan-21 
3NFN2-Jan-20 
3FY4-Sep-21 
4NFN25-Nov-20 
4FY14-Jul-21Y

 

 

 

 

</p body>

1 ACCEPTED SOLUTION

@Anonymous 
This seems to work:

NF-F (column) =
var _edate = NF_conversion[Transaction Date ]
var _sdate = _edate-360
var _customer = NF_conversion[ID]
return
IF(and(
NF_conversion[Product]="F"

&&NF_conversion[Financial Product Aquired (Calendar Year ) ]="Y",

countrows(FILTER(all(NF_conversion),NF_conversion[Product]="NF"
&&NF_conversion[Transaction Date ]>=_sdate
&&NF_conversion[Transaction Date ]<=_edate
&&_customer=NF_conversion[ID]))>=1),"Y","")

ValtteriN_0-1642488373689.png

 







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

Proud to be a Super User!




View solution in original post

7 REPLIES 7
ValtteriN
Super User
Super User

Hi,

Here is one way to do this with a measure:

NF-F =
var _edate = MAX(NF_conversion[Transaction Date ])
var _sdate = _edate-360
var _customer = MAX(NF_conversion[ID])
return
IF(and(
MAX(NF_conversion[Product])="F",

countrows(FILTER(all(NF_conversion),NF_conversion[Product]="NF"
&&NF_conversion[Transaction Date ]>=_sdate
&&NF_conversion[Transaction Date ]<=_edate
&&_customer=NF_conversion[ID]))>=1),"Y","")
 
 
End result:
ValtteriN_0-1642441179066.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!






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

Proud to be a Super User!




Anonymous
Not applicable

@ValtteriN  Thankyou so mcuh for code. 

 

I need it in column as I have to further use it to filter data. 

 

Hi,

Here is the column version:

NF-F (column) =
var _edate = NF_conversion[Transaction Date ]
var _sdate = _edate-360
var _customer = NF_conversion[ID]
return
IF(and(
NF_conversion[Product]="F",

countrows(FILTER(all(NF_conversion),NF_conversion[Product]="NF"
&&NF_conversion[Transaction Date ]>=_sdate
&&NF_conversion[Transaction Date ]<=_edate
&&_customer=NF_conversion[ID]))>=1),"Y","")

 
ValtteriN_0-1642442296834.png

 





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

Proud to be a Super User!




Anonymous
Not applicable

@ValtteriN 

I have to apply Financial Product Aquired  filter  in the code , so that it only gives conversion for the customers who had aquired Financial products and in the past (360 days )  they had NF products. Can suggest where to apply that filter in code . Thnanks

 

Here should suffice:

NF-F (column) =
var _edate = NF_conversion[Transaction Date ]
var _sdate = _edate-360
var _customer = NF_conversion[ID]
return
IF(and(
NF_conversion[Product]="F",

 

countrows(FILTER(all(NF_conversion),NF_conversion[Product]="NF"
&&NF_conversion[Transaction Date ]>=_sdate
&&NF_conversion[Transaction Date ]<=_edate
&&NF_conversion[ProductAquired]="Y"
&&_customer=NF_conversion[ID]))>=1),"Y","")




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

Proud to be a Super User!




Anonymous
Not applicable

 

Hi @ValtteriN ,  this is not working on my end can you please  suggest. I have added filter product acquired  is Y.  As I need conversion for only those that have actually aquired the Financial product only .  

Channa_1-1642454291882.png

 

@Anonymous 
This seems to work:

NF-F (column) =
var _edate = NF_conversion[Transaction Date ]
var _sdate = _edate-360
var _customer = NF_conversion[ID]
return
IF(and(
NF_conversion[Product]="F"

&&NF_conversion[Financial Product Aquired (Calendar Year ) ]="Y",

countrows(FILTER(all(NF_conversion),NF_conversion[Product]="NF"
&&NF_conversion[Transaction Date ]>=_sdate
&&NF_conversion[Transaction Date ]<=_edate
&&_customer=NF_conversion[ID]))>=1),"Y","")

ValtteriN_0-1642488373689.png

 







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.

Top Solution Authors