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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DDL76
Regular Visitor

DAX: Filter by date in another Table

Hi there,

 

I curently have this DAX formula that works. 🙂

FC = Calculate(sumx(Transactions,Transactions[Amount] *related(Codes[Natural Value])) ,FILTER(Transactions,Transactions[Scenario]="Actuals"))
 
However i need to limit the data returned further by the date...
The Transactions[Date] must be equal to or less than the "Last Close" date in the table below called "DATES".
DATE TYPEDATE
Last Close30/06/2024

 

Many Thanks in advance for your assistance!!!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @DDL76 ,

 

Please update it.

FC = 
var _last_date=CALCULATE(MAX('DATES'[DATE]),FILTER(ALLSELECTED('DATES'),'DATES'[DATE TYPE]="Last Close"))

return
Calculate(sumx(Transactions,Transactions[Amount] *related(Codes[Natural Value])) ,FILTER(Transactions,Transactions[Scenario]="Actuals"&&Transactions[Date]<=_last_date  ))

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

4 REPLIES 4
DDL76
Regular Visitor

Neeko Tang, Many thanks its all working as intended! 🙂

Anonymous
Not applicable

Hi @DDL76 ,

 

Please try this:

FC = 
var _last_date=CALCULATE(MAX('Transactions'[DATE]),FILTER(ALLSELECTED('Transactions'),'Transactions'[DATE TYPE]="Last Close"))

return
Calculate(sumx(Transactions,Transactions[Amount] *related(Codes[Natural Value])) ,FILTER(Transactions,Transactions[Scenario]="Actuals"&&Transactions[Date]<=_last_date  ))

vtangjiemsft_0-1720750061183.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Hi there,
Many thanks for your help, I think we are very close! I think the problem is the data in the table "Transactions" needs to be limited to based on a date held in another table called "Dates".

So Transactions[Date] must be = to or less than DATES[DATE] where DATES[DATE TYPE] = 'Last Close'.
It might be worth noting that there is no relationsip between these tables, not sure if this causes an issue? I have included images of the tables and the error shown in the DAX formula. Many thanks again!!!


Screenshot 2024-07-12 101614.pngScreenshot 2024-07-12 101525.pngScreenshot 2024-07-12 101714.png

 

 

Anonymous
Not applicable

Hi @DDL76 ,

 

Please update it.

FC = 
var _last_date=CALCULATE(MAX('DATES'[DATE]),FILTER(ALLSELECTED('DATES'),'DATES'[DATE TYPE]="Last Close"))

return
Calculate(sumx(Transactions,Transactions[Amount] *related(Codes[Natural Value])) ,FILTER(Transactions,Transactions[Scenario]="Actuals"&&Transactions[Date]<=_last_date  ))

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.