Forum Discussion
VeemalS
3 years agoHelper I
Target Allocation by Day
Hello, I have a Target Table in EUR as follows Month Target Apr 20,965,000 May 18,876,560 Jun 17,987,908 Jul ...
VeemalS
3 years agoHelper I
Hello,
Just to clarity that the wrong dax code was posted yesterday.
In fact to calculate the no of days in the month I have used the following:
DayInMonth =
var dat = min(Dates[DatesKey])
return
CALCULATE(DATEDIFF(DATE(YEAR(dat), MONTH(dat),1), EOMONTH(dat,0),DAY)+1)
Then we have created a another measure Target Day allocated by dividing the Target Monthly amount (EUR) by the Days in the month
thanks
Veemal
Anonymous
3 years agoNot applicable
Hi VeemalS ,
My Date table is as below.
Date =
ADDCOLUMNS( CALENDAR(DATE(2022,01,01),DATE(2022,12,31)),"Year",YEAR([Date]),"Month",MONTH([Date]),"MonthName",FORMAT([Date],"MMM"))
Relationship:
Measure:
Target by Day =
VAR _COUNT =
COUNT ( 'Date'[Date] )
VAR _TARGET =
CALCULATE (
SUM ( 'Table'[Target] ),
FILTER ( 'Table', 'Table'[Month] = MAX ( 'Date'[MonthName] ) )
)
RETURN
DIVIDE ( _TARGET, _COUNT )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.