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
kevinedora
Helper I
Helper I

Return value from 3 months ago

Hi,

 

I'm trying to add another column to "Table 1" basically saying what's the latest movement from 3 months ago per account(it should be "installs" only). Table 2 should be the lookup table. Criteria should be the same account no. and item.

 

I wanted this to be in a matrix, so i'm not sure if calc column should be the correct response or measure maybe? Please advise. Thank you!

 

Table 1

Period (YYYY-MM-DD)Account no.Item
202203016173262992SFEM
202203016173262991SFEM

 

Table 2

Period (YYYY-MM-DD)Account no.MovementItem
20220102617326299

Installs

2SFEM
20220103617326299Recon2SFEM
20220104617326299Discon1SFEM

 

Result

 

Period (YYYY-MM-DD)Account no.ItemInstalls 3Months
202203016173262992SFEMYes
202203016173262991SFEMNo
1 ACCEPTED SOLUTION

@kevinedora 

is this what you want

Column =
VAR _install=maxx(FILTER('Table 2','Table 1'[Account no.]='Table 2'[Account no.] &&'Table 1'[Item]='Table 2'[Item] && 'Table 2'[Movement]="installs" && year('Table 1'[Period (YYYY-MM-DD)])=year('Table 2'[Period (YYYY-MM-DD)])&&month('Table 1'[Period (YYYY-MM-DD)])=month('Table 2'[Period (YYYY-MM-DD)])+2),'Table 2'[Movement])
return if(_install="","N","Y")
 
you can change +2 to +1 or remove it to get 2 month ago or within the month




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

Proud to be a Super User!




View solution in original post

5 REPLIES 5
ryan_mayu
Super User
Super User

@kevinedora 

not clear about the 3 month ago. it looks like the date of install is only two month ago. could you pls clarify more about this?

 

maybe you can try below DAX to create a column

Column = 
VAR _install=maxx(FILTER('Table 2','Table 1'[Account no.]='Table 2'[Account no.] &&'Table 1'[Item]='Table 2'[Item] && 'Table 2'[Movement]="installs"),'Table 2'[Movement])
return if(_install="","N","Y")

1.PNG





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

Proud to be a Super User!




Hello @ryan_mayu 

 

Thanks for the response. Apologies for the confusion, the example above should be correct since I also count march from the "3 months" ago criteria.

Also, from your calc column, what if the account had been installed in December 2021? the formula would return "Yes". I just need specifically from 3 months ago (January).

In the future, I might use the formula also for the "2 months ago" criteria or "within the month". I hope this clarifies my concern.

@kevinedora 

is this what you want

Column =
VAR _install=maxx(FILTER('Table 2','Table 1'[Account no.]='Table 2'[Account no.] &&'Table 1'[Item]='Table 2'[Item] && 'Table 2'[Movement]="installs" && year('Table 1'[Period (YYYY-MM-DD)])=year('Table 2'[Period (YYYY-MM-DD)])&&month('Table 1'[Period (YYYY-MM-DD)])=month('Table 2'[Period (YYYY-MM-DD)])+2),'Table 2'[Movement])
return if(_install="","N","Y")
 
you can change +2 to +1 or remove it to get 2 month ago or within the month




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

Proud to be a Super User!




Thanks @ryan_mayu. Can you please send me the sample file? For some reason 'Table 1'year(date) = 'Table 2'year(date) is not working.

@kevinedora 

pls see the attachment below





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.