Forum Discussion

srk_powerbi's avatar
srk_powerbi
Helper II
5 years ago
Solved

Calculation help needed

Hi , i need osme help calculating a measure. i have below 2 tables. Both are related by AccountNum coulumn.  I need to calculate Measures for 1. calculate the Count(AccountNum) where RegisteredDat...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi srk_powerbi ,

     

    Based on your description, you can create some measures as follows.

    count_today = CALCULATE(COUNT('Table 1'[AccountNum]),'Table 1'[RegisteredDate]=TODAY()-1)

    count_previous =

    var x1 = MAXX(FILTER(ALL('Table 1'),[RegisteredDate]<TODAY()-1&&WEEKDAY('Table 1'[RegisteredDate],2)<6),'Table 1'[RegisteredDate])

    return

    CALCULATE(COUNT('Table 1'[AccountNum]),'Table 1'[RegisteredDate]=x1)

    sum_today = CALCULATE(SUM('Table 2'[Amount]),'Table 1'[RegisteredDate]=TODAY()-1)

    sum_previous =

    var x1 = MAXX(FILTER(ALL('Table 1'),[RegisteredDate]<TODAY()-1&&WEEKDAY('Table 1'[RegisteredDate],2)<6),'Table 1'[RegisteredDate])

    return

    CALCULATE(SUM('Table 2'[Amount]),'Table 1'[RegisteredDate]=x1)


    Result:

     

    Hope that's what you were looking for.

    Best Regards,

    Yuna

     

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