I've a simple PowerPivot workbook with some SalesTargets in one table, these are by month.. typically the 1st of each month, and a date dimension.
I have written (through much pain) a DAX query to apportion the monthly target that we recieve down to days for the purposes of inter-month reporting (otherwise there would be no target data at that grain)..
I'm finding however that there is something up with my query that i'm not sure how to fix in that if i attempt to only show an apportioned target value at day level where that day is a working day things go a bit wrong... basically nothing is displayed at any hierarchy level, and i don't know why :(
without knowing why, i can't fix it... here is my current code:
Measure :=
CALCULATE (
SUMX (
VALUES ( Dates[Date] ),
CALCULATE (
CALCULATE (
SUM ( SalesTargets[Target] ),
ALL ( Dates[Date] ),
SUMMARIZE ( Dates, Dates[MonthName] )
)
/ CALCULATE (
DISTINCTCOUNT ( Dates[Date] ),
ALL ( Dates[Date] ),
Dates[IsWorkingDay] = 1,
SUMMARIZE ( Dates, Dates[MonthName] )
)
)
),
Dates[IsWorkingDay] = 1
)
The code is attempting to sum the sales targets at a month level and then divide that number the sum of dates where IsWorkingDay = 1
This process is carried out for all Dates[Date] (lowest grain) of the date table, and then i attempt to filter on the dates where IsWorkingDay = 1 again..
If i remove the Working day logic from both areas in the code, everything works fine.. and rolls up across months, quarters and years without a problem..
I am sure that if i understood what the issue was here, I would be able to resolve it... i just cant see it though.
Thanks