Forum Discussion

LeszekGL's avatar
LeszekGL
New Member
1 year ago
Solved

Problem with Total sales calculation - please help

  Hello everyone I am having a problem getting the correct sales total. In the example below, I am calculating the sales total from the beginning of each month to the 10th of the month....
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi LeszekGL ,

     

    Based on your description, I created these data.


    Create MEASURE.

    MEASURE =
    VAR _mindate =
        EOMONTH ( MIN ( 'Table'[Date] ), -1 ) + 1
    VAR _maxdate =
        EOMONTH ( MAX ( 'Table'[Date] ), -1 ) + 10
    VAR _sum1 =
        CALCULATE (
            SUM ( 'Table'[Amount] ),
            'Table'[Date] >= _mindate
                && 'Table'[Date] <= _maxdate
        )
    RETURN
        _sum1
    

     

    Measure 2 = 
    SUMX('Table',[MEASURE])
    

     

    Measure 3 = 
    IF(HASONEVALUE('Table'[Date].[Month]),[MEASURE],[Measure 2])
    

     

    If your Current Period does not refer to this, please clarify in a follow-up reply.

     

    Best Regards,

    Clara Gong

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.