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
Anonymous
Not applicable

DAX Pivot and Calculations

Hello Community. I have a challenge that I need to solve for exclusively in DAX that I'm having some trouble knowing where/how to get started.

 

My table so far (left below) has a a job by job detail of an estimated completion date and how much is left to spend for each job. What I want to do, in the simplist form, is to spread/forecast the spend dynamically based off of the current month offset to the estimated completion date/month of the job (right below).

  • For Job 1 below there's only one month of offset so I would expect all of the money to be spent in October
  • For Job 6 there are 3 months of offset so I would expect that the amount Left to Spend will be spread evenly (for now) month by month until its estimated completion month of December.

 

This means though that as time goes on into the next month that my current month offset will change and I'll need to move the forecast dynamically into the compressed or expanded amount of months between today and whatever the current month offset is. 


I hope the illustration below helps to explain the situation better...

 

Again, the goal is to not go back into the PQE to do this but to do it while remaining in the model with DAX.

 

2020-09-11_11-20-11.png

Thank you in advance for your input and suggetions.

-Nate

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@Anonymous OK, so a matrix visual with Month date and Offset in column hierarchy. Job is in rows. Then maybe:

Measure =
  VAR __Job = MAX([Job])
  VAR __DateMax = MAX([Derived ECD])
  VAR __DateMin = MIN([Derived ECD])
  VAR __Offset = MAX([DECD Month Offset])
  VAR __Table = 
    FILTER(
      ALL('Table'),
      [Job]=__Job && [Derived ECD]>=__DateMin && [Derived ECD]<=__DateMax
    )
  VAR __Amount = MAXX(__Table,[Left to Spend])
  VAR __Offset2 = MAXX(__Table,[DECD Month Offset])
RETURN
  IF(__Offset <= __Offset2, __Amount / __Offset, BLANK())

If issues @ me and post sample data as text. Thanks.

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.