Forum Discussion

KG1's avatar
KG1
Resolver I
3 years ago
Solved

Measure Interpretation

Hi

 

I am working on a dashboard that has been developed by someone else

 

I am struggling to breakdown this measure and what it is actually doing

 

= CALCULATE(COUNTA('Export'[Order]),DATESBETWEEN('Export'[Actual_Finish_date],max('Export'[Actual_Finish_date])-weekday(max('Export'[Actual_Finish_date]),3),max('Export'[Actual_Finish_date])))

 

Can someone please assist?

 

Thank you in advance

  • Its easier to read if its properly formatted

    CALCULATE (
        COUNTA ( 'Export'[Order] ),
        DATESBETWEEN (
            'Export'[Actual_Finish_date],
            MAX ( 'Export'[Actual_Finish_date] )
                - WEEKDAY ( MAX ( 'Export'[Actual_Finish_date] ), 3 ),
            MAX ( 'Export'[Actual_Finish_date] )
        )
    )

    So 

    MAX ( 'Export'[Actual_Finish_date] )
         - WEEKDAY ( MAX ( 'Export'[Actual_Finish_date] ), 3 )

    gives the Monday of the relevant date. Using that as a parameter to DATESBETWEEN it is counting the number of orders within that week.

3 Replies

  • I think its counting the number of orders in a given week, starting from the Monday

    • KG1's avatar
      KG1
      Resolver I

      What is the purpose of this part of the measure? weekday(max('Export'[Actual_Finish_date]),3), ?

       

      Thank you

      • johnt75's avatar
        johnt75
        Super User

        Its easier to read if its properly formatted

        CALCULATE (
            COUNTA ( 'Export'[Order] ),
            DATESBETWEEN (
                'Export'[Actual_Finish_date],
                MAX ( 'Export'[Actual_Finish_date] )
                    - WEEKDAY ( MAX ( 'Export'[Actual_Finish_date] ), 3 ),
                MAX ( 'Export'[Actual_Finish_date] )
            )
        )

        So 

        MAX ( 'Export'[Actual_Finish_date] )
             - WEEKDAY ( MAX ( 'Export'[Actual_Finish_date] ), 3 )

        gives the Monday of the relevant date. Using that as a parameter to DATESBETWEEN it is counting the number of orders within that week.