Forum Discussion

unknown917's avatar
unknown917
Helper IV
6 months ago
Solved

Improper Sum with slicer

I have a table with shipping points, dates and total resources.  I have used measures to calculate the count of dates the sum of resources.

 

The expected result is to calculate the sum of resources by count of date.  The slicer is intended drill down to the shipping point level, but show the grand total when a slicer is not used.  The slicer works correctly with Res/Days, but not the grand total when the slicer is not used.  The intended result when the shipping point slicer is not selected is 321 Res/Days but it is calculating 153.  Any help with this would be greatly appreciated.

Shipping PointSum of Tot ResCount of DatesRes/Days
1068171199
1070120206
1073159208
10747572530
10762812014
10783602216
11259082045
112648202
11276012030
11299462047
11313812019
11325002025
11352142110
11385192026
11644992025
1185147207

 

  • Please try the measure logic below:

    Total Res =
    SUM ( Fact[Total Resources] )
    
    Days =
    DISTINCTCOUNT ( Fact[Date] )
    
    Res/Days =
    VAR _perPoint =
        SUMX(
            VALUES( Fact[Shipping Point] ),
            DIVIDE(
                CALCULATE( [Total Res] ),
                CALCULATE( [Days] )
            )
        )
    RETURN
    _perPoint

3 Replies

  • Hi,

    I am not sure about how the measures are written, but please try something like below with the two measures.

     

    expected result measure =
    SUMX (
        VALUES ( Data[Shipping Point] ),
        DIVIDE ( [Sum to total resources:], [Count of days] )
    )
    
  • Please try the measure logic below:

    Total Res =
    SUM ( Fact[Total Resources] )
    
    Days =
    DISTINCTCOUNT ( Fact[Date] )
    
    Res/Days =
    VAR _perPoint =
        SUMX(
            VALUES( Fact[Shipping Point] ),
            DIVIDE(
                CALCULATE( [Total Res] ),
                CALCULATE( [Days] )
            )
        )
    RETURN
    _perPoint
    • unknown917's avatar
      unknown917
      Helper IV

      Thank you!  I used the measure in conjunction with my sum & count measure and it worked!