Forum Discussion
jcampbell474
Helper IV
7 years agoPlease help w/DAX
I'm relatively new to PBI & DAX, looking for some guidance with this expression. Using a fiscal (master) calendar, I need to calculate sales for the previous week. I have two tables, Fact and Ma...
- 7 years ago
Filtering the Master Calendar table (via DAX) in the expression didn't filter the Fact table, so I just added fiscal date columns to the fact table and applied the filter(s) there, using DAX.
It works fine.
RobbeVL
Impactful Individual
7 years agoHi,
For the sales of a previous period I would simply use something like this:
NBWTD =
CALCULATE (
SUM ( QMFact[BoundCount] ),
DIMDATE[Weeknr] = WEEK(TODAY())-1
)Another function you coud use:
https://docs.microsoft.com/en-us/dax/parallelperiod-function-dax
- jcampbell4747 years ago
Helper IV
Thank you. I wish I could use native PBI date functions, but have a fiscal calendar.
FYI, I took another stab at it:
NBPW = VAR PYW = SELECTEDVALUE ( DateReference[PrevYearWeek] ) RETURN SUMX(CALCULATETABLE(QMFact,FILTER ( Master_Calendar, Master_Calendar[FiscalYearWeek] = PYW )), QMFact[NB])- jcampbell4747 years ago
Helper IV
Filtering the Master Calendar table (via DAX) in the expression didn't filter the Fact table, so I just added fiscal date columns to the fact table and applied the filter(s) there, using DAX.
It works fine.