Forum Discussion

BMM27's avatar
BMM27
Icon for Helper I rankHelper I
2 years ago
Solved

Measure Monthly to diary.

Hi, I have a measure [A] where it gives total monthly value. Additionally, I have a measure [B] that calculates the daily value by dividing [A] by the total number of days in the month. However, rega...
  • BMM27's avatar
    BMM27
    2 years ago

    Hi, here is my solution, but It causes anther question:
    My count selected days measure:

    SelectedDays=
    VAR Month= MONTH(MAX(Dim_Calendar[Date]))
    VAR y = YEAR(MAX(Dim_Calendar[Date]))
    VAR SelectedDate=
        FILTER(
            ALL(Dim_Calendar),
            Dim_Calendar[Date] >= MIN(Dim_Calendar[Date]) &&
            Dim_Calendar[Date] <= MAX(Dim_Calendar[Date]) &&
            MONTH(Dim_Calendar[Date]) = Month&&
            YEAR(Dim_Calendar[Date]) = y
        )
    RETURN
        COUNTROWS(SelectedDate)
     
    Daily Budget = (CALCULATE([Budget], STARTOFMONTH(Dim_Calendar[Date])) / DAY(EOMONTH(MIN(Dim_Calendar[Date]), 0))) * [SelectedDays]

    What happens is if I put this on a table, the row of totals is wrong, same as if I put on a Card. Only when the data is with each month selected the data is perfectly correct. 
    With a Card, maybe, I understand it a llittle but on a table, the totals it have to sum all the values but they don't.

    I know this is because it's made with a measure, but I think this is only the solution.

    If anyone knows how to solve this, I would appreciate it, thanks!