Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Power BI Aggregation Tables and Distinct Count a value

Hi, I am currently setting up my first data model using Power BI Aggregation tables and am having a problem getting distinct count to work with it.  I seem to be able to get sums to work just fine b...
  • v-yingjl's avatar
    v-yingjl
    5 years ago

    Hi Anonymous ,

    Based on your description, you can create this calculated table:

    New Table =
    SUMMARIZE (
        'Table',
        'Table'[StopNumber],
        'Table'[TripNumber],
        'Table'[Billdate],
        'Table'[OrderLocationCode],
        'Table'[Location],
        "Total_Stop",
            CALCULATE (
                SUM ( 'Table'[StopActualMiles] ),
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[TripNumber] = EARLIER ( 'Table'[TripNumber] )
                )
            ),
        "Total_Miles",
            CALCULATE (
                SUM ( 'Table'[Weight1] ),
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[TripNumber] = EARLIER ( 'Table'[TripNumber] )
                )
            ),
        "Total_Drive",
            CALCULATE (
                SUM ( 'Table'[DriveTimeHours] ),
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[TripNumber] = EARLIER ( 'Table'[TripNumber] )
                )
            )
    )
    

    Attached a sample file in the below, hopes to help you.

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.