Forum Discussion

CSmith_HW's avatar
CSmith_HW
Frequent Visitor
5 years ago
Solved

DAX Help! Return date that cumulative total surpassed a column value

Hi guys,

 

I have a campaign table that look like the below:

 

Campaign IDTarget Price
1£50,000
2£70,000
3£120,000
4£35,000

 

and a table of deals that looks like:

Deal IDCampaign IDPriceDate
11£5,00008/02/2021
22£7,00024/12/2020
32£11,00012/01/2021
43£13,50030/10/2020
51£3,50001/02/2021

 

The 2 tables are joined in a 1-to-many via campaign ID. Now, what I would like to do, preferably in a calculated column on the campaign table is return the date at which the cumulative sum of "Price" surpassed the Target Price.

So the logic would look something like this:

  1. Use the date on the deal table to create a cumulative running total of all deals for each campaign.

  2. Monitor when the cumulative running total surpasses the target price

  3. Return the date that final deal happened to take us over the target price

 

Any help would be great,

Thanks

  • hi i have a problem understanding context transition but i think this works.

    probably a much neater way of doing it.

    had to fiddle your data as none of the targets met as you put them.

     

     

2 Replies

  • hi i have a problem understanding context transition but i think this works.

    probably a much neater way of doing it.

    had to fiddle your data as none of the targets met as you put them.

     

     

    • CSmith_HW's avatar
      CSmith_HW
      Frequent Visitor

      Yep I used dummy data in my example - it works though thanks!