Forum Discussion

dmartiprev's avatar
dmartiprev
Frequent Visitor
3 years ago
Solved

Sum data from another table with different aggregation of time

I have two tables: DailyData and MonthlyData.    In the DailyData table, I have columns: "Date", "YrMo" which is shows the year and month that the Date resides in, and I have a third column of data...
  • v-jianboli-msft's avatar
    3 years ago

    Hi dmartiprev ,

     

    Based on your description, I have creeated a simple sample:

    If you need a measure:

    Measure = CALCULATE(SUM(DailyData[Sales]),FILTER(ALL(DailyData),[YrMo]=MAX('MonthlyData'[YrMo])))

    Output:

    If you need a column:

    Column = SUMX(FILTER('DailyData',[YrMo]=EARLIER(MonthlyData[YrMo])),[Sales])

    Output:

    Best Regards,

    Jianbo Li

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