Forum Discussion

sabilahmed's avatar
sabilahmed
Resolver I
3 years ago
Solved

Measure in Live Connection - Incorrect Total

Hello,   I know there have been many solutions on incorrect totals from measures in Live Connection, but I can't seem to figure out the solution for my measure:     No of Sessions = VAR _enco...
  • sabilahmed's avatar
    3 years ago

    Solved! I used ADDCOLUMNS and SUMMARIZE:

     

     

    No of Sessions = 
    
    VAR SessionsTable =
    
            ADDCOLUMNS (    
                SUMMARIZE (
                'Location-Practice-Rendering',
                'Location-Practice-Rendering'[LeafName]
                ),
                "Total Encounters",
                    [Encounters],
                "No of Days Total",
                    [No of Days],
                "No of Sessions Per Day",
                    IF ( [Encounters] <= 2, 0,
                    IF ( [Encounters] > 10, 2, 1
                        )
                    )
            )
    
            RETURN SUMX( SessionsTable, [No of Days Total] * [No of Sessions Per Day])

     

     

    Where [Encounters] and [No of Days] are separate measures:

     

     

    Encounters = CALCULATE (
                    [Amount],
                    FILTER (
                        ALL ( 'Profitability Account' ),
                        'Profitability Account'[Description] = "Encounters"
                    ))

     

     

     

    No of Days = 
        CALCULATE (
                    DISTINCTCOUNT (
                    'Time'[CalendarDate]),
                    FILTER (
                    'Time',
                    'Time'[DayOfWeekdayDescription] <> "Sunday"
                    && 'Time'[DayOfWeekdayDescription] <> "Saturday"  )
                    )

     

     

    Results:

     

    (Doctor Days is simply a measure: No of Sessions divided by 2).