Forum Discussion
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.00 | Actual |
| Oct-18 | 12,000.00 | Actual |
| Nov-18 | 12,000.00 | Actual |
| Dec-18 | 12,000.00 | Actual |
| Jan-19 | 12,000.00 | Actual |
| Feb-19 | 12,000.00 | Actual |
| Mar-19 | 12,000.00 | Actual |
| Apr-19 | 12,000.00 | Actual |
| May-19 | 12,000.00 | Actual |
| Jun-19 | 12,000.00 | Actual |
| 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.00 | Forecast | Issue part |
| Jun-19 | 12,000.00 | Forecast | Issue part |
| Jul-19 | 12,000.00 | Forecast | |
| Aug-19 | 12,000.00 | Forecast | |
| Sep-19 | 12,000.00 | Forecast | |
| Oct-19 | 12,000.00 | Forecast | |
| Nov-19 | 12,000.00 | Forecast | |
| Dec-19 | 12,000.00 | Forecast |
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-18 | Oct-18 | Nov-18 | Dec-18 | Jan-19 | Feb-19 | Mar-19 | Apr-19 | May-19 | Jun-19 | Jul-19 | Aug-19 | Sep-19 | Oct-19 | Nov-19 | Dec-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
- parry2kSuper User
cristianml how these two tables are related? I guess you have date dimension with which these tables are related?
- cristianmlPost 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"