Forum Discussion

cristianml's avatar
cristianml
Post Prodigy
7 years ago

Help with DAX Formula for 2 tables

Hi,

I need help to fix an issue I have. I'm trying to Sum 2 tables but with some king of restriction. I have these 2 tables and I need to sum both columns of amounts but considering only the Actuals in Ad doc costs table till a change happen in "FT Forecast 4QF" in the column of "Actual or Forecast" :

 

Ad hoc costs
 PostingPeriod  Amount  Actual or Forecast 
Sep-18  12,000.00Actual
Oct-18  12,000.00Actual
Nov-18  12,000.00Actual
Dec-18  12,000.00Actual
Jan-19  12,000.00Actual
Feb-19  12,000.00Actual
Mar-19  12,000.00Actual
Apr-19  12,000.00Actual
May-19  12,000.00Actual
Jun-19  12,000.00Actual

 

FT Forecast 4QF 
 PostingPeriod  Amount  Actual or Forecast  
Sep-18                 -  Actual 
Oct-18                 -  Actual 
Nov-18                 -  Actual 
Dec-18                 -  Actual 
Jan-19                 -  Actual 
Feb-19                 -  Actual 
Mar-19                 -  Actual 
Apr-19                 -  Actual 
May-19  12,000.00ForecastIssue part
Jun-19  12,000.00ForecastIssue part
Jul-19  12,000.00Forecast 
Aug-19  12,000.00Forecast 
Sep-19  12,000.00Forecast 
Oct-19  12,000.00Forecast 
Nov-19  12,000.00Forecast 
Dec-19  12,000.00Forecast 

 

To see this better in the model, I tried 2 different DAX formulas but, with both I have a different issue:

 

In this case If I try this formula the AMOUNT is NOT coming into the Visual:

 

With this formula the issue is in the periods that are duplicated from both tables:

 

 

This should be the correct one              
Sep-18Oct-18Nov-18Dec-18Jan-19Feb-19Mar-19Apr-19May-19Jun-19Jul-19Aug-19Sep-19Oct-19Nov-19Dec-19
  12,000.00  12,000.00  12,000.00  12,000.00  12,000.00  12,000.00  12,000.00  12,000.00  12,000.00  12,000.00  12,000.00  12,000.00  12,000.00  12,000.00  12,000.00  12,000.00

 

How could I fix this ? 

 

Thanks 

 

 

 

2 Replies

  • cristianml how these two tables are related? I guess you have date dimension with which these tables are related?

    • cristianml's avatar
      cristianml
      Post Prodigy

      Hi parry2k ,

       

      Yes, These to tables has many relationship and are related, it works perfect.  The only thing is to figure out that particular case I mentioned before. It occured to me that I can use a Dax formula Based on other column.  

      In my head I think something like this: calculate/sum only with this condition:

       

      Calculate the SUM of Ad Hoc Cost table considering the MAX Date in FT Forecast "Actual or Forecast" filtered by "Actual"