Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 17881

DAX problem calculating Prior Fiscal YTD

$
0
0

Hi everyone,

I'm trying to calculate a measure based on prior fiscal year to date numbers. My dates table has every calendar date, however the measure I'm using is aggregated by week ending date in the source table. The problem with using DATESYTD for my fiscal year is the prior year calculation goes through to the end of the entire month, while the current YTD calculation goes through the current week. I've done of digging and got the following formula to work, however when I slice it in certain ways I get the dreaded DATEADD function works with continguous dates. I tried wrapping SUMX around my formula, however the formula spins and spins forever when I try to use it. CalDate in the formula is the dates key in my dates table, however the Production Revenue number is based on a WeekEndingDate field. Thanks in advance for any help!

 

Prior Year Production Revenue calc:=CALCULATE([Production Revenue],
           DATEADD(
                   FILTER(DATESYTD(Dates[CalDate], "6/1"),
                          Dates[CalDate]<=
                          LASTNONBLANK(Dates[CalDate], [Production Revenue])
                         ),
                  -1,Year
                  )
          )


Viewing all articles
Browse latest Browse all 17881

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>