Forum Discussion

tvathis's avatar
tvathis
Frequent Visitor
2 years ago
Solved

Changing Monthly to Quarterly

Hi! 

I currently have a measure that pulls from # of deliveries from a spreadsheet to match up with the dates in the table.  

I would like to change this to quarterly instead.  

Is there an easy way to do this?   This is my current measure.  

 

Dashboards =
VAR _A =
SUM (charges[RVU Amount] )
VAR _B =
SWITCH (
STARTOFMONTH ( 'charges'[begin_date_of_service] ),
DATE ( 2024, 1, 1 ), SUM ( 'Deliveries'[1/1/2024] ),
DATE ( 2024, 2, 1 ), SUM ( 'Deliveries'[2/1/2024] ),
DATE ( 2024, 3, 1 ), SUM ( 'Deliveries'[3/1/2024] ),
DATE ( 2024, 4, 1 ), SUM ( 'Deliveries'[4/1/2024] ),
DATE ( 2024, 5, 1 ), SUM ( 'Deliveries'[5/1/2024] ),
DATE ( 2024, 6, 1 ), SUM ( 'Deliveries'[6/1/2024] ),
DATE ( 2024, 7, 1 ), SUM ( 'Deliveries'[7/1/2024] ),
DATE ( 2024, 8, 1 ), SUM ( 'Deliveries'[8/1/2024] ),
DATE ( 2024, 9, 1 ), SUM ( 'Deliveries'[9/1/2024] ),
DATE ( 2024, 10, 1 ), SUM ( 'Deliveries'[10/1/2024] ),
DATE ( 2024, 11, 1 ), SUM ( 'Deliveries'[11/1/2024] ),
DATE ( 2024, 12, 1 ), SUM ( 'Deliveries'[12/1/2024] )
)
RETURN
DIVIDE ( _A, _B )

  • tvathis Maybe:

    Dashboards =
    VAR _A = SUM (charges[RVU Amount] )
    VAR _B = STARTOFMONTH ( 'charges'[begin_date_of_service] )
    VAR _C =
    SWITCH (
    TRUE(),
    _B <= DATE ( 2024, 3, 1 ), SUM ( 'Deliveries'[1/1/2024] ) + SUM ( 'Deliveries'[2/1/2024] ) + SUM ( 'Deliveries'[3/1/2024] ),
    _B <= DATE ( 2024, 6, 1 ), SUM ( 'Deliveries'[4/1/2024] ) + SUM ( 'Deliveries'[5/1/2024] ) + SUM ( 'Deliveries'[6/1/2024] ),
    _B <= DATE ( 2024, 9, 1 ), SUM ( 'Deliveries'[7/1/2024] ) + SUM ( 'Deliveries'[8/1/2024] ) + SUM ( 'Deliveries'[9/1/2024] ),
    SUM ( 'Deliveries'[10/1/2024] ) + SUM ( 'Deliveries'[11/1/2024] ) + SUM ( 'Deliveries'[12/1/2024] )
    )
    RETURN
    DIVIDE ( _A, _C )

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    tvathis Maybe:

    Dashboards =
    VAR _A = SUM (charges[RVU Amount] )
    VAR _B = STARTOFMONTH ( 'charges'[begin_date_of_service] )
    VAR _C =
    SWITCH (
    TRUE(),
    _B <= DATE ( 2024, 3, 1 ), SUM ( 'Deliveries'[1/1/2024] ) + SUM ( 'Deliveries'[2/1/2024] ) + SUM ( 'Deliveries'[3/1/2024] ),
    _B <= DATE ( 2024, 6, 1 ), SUM ( 'Deliveries'[4/1/2024] ) + SUM ( 'Deliveries'[5/1/2024] ) + SUM ( 'Deliveries'[6/1/2024] ),
    _B <= DATE ( 2024, 9, 1 ), SUM ( 'Deliveries'[7/1/2024] ) + SUM ( 'Deliveries'[8/1/2024] ) + SUM ( 'Deliveries'[9/1/2024] ),
    SUM ( 'Deliveries'[10/1/2024] ) + SUM ( 'Deliveries'[11/1/2024] ) + SUM ( 'Deliveries'[12/1/2024] )
    )
    RETURN
    DIVIDE ( _A, _C )
    • tvathis's avatar
      tvathis
      Frequent Visitor

      That is not working.  It's giving me different calculations for the same quarter.  

      Would changing it to startofquarter instead of startofmonth work? 

      • tvathis's avatar
        tvathis
        Frequent Visitor

        Greg_Deckler 

        That is not working.  It's giving me different calculations for the same quarter.  

        Would changing it to startofquarter instead of startofmonth work?