Forum Discussion

MatthewMcL's avatar
MatthewMcL
Frequent Visitor
8 years ago
Solved

Transaction level date to Rolling Time Summary

Hello, I am very new to PowerBI, DAX and M Query but I am very familiar with general SQL Queries, Excel and general programming. I’ve been asked to develop something in powerbi and I’ve been hittin...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Hmm, not sure if you want to get the following results.

     

     

    If it is, first create a calcuated column and use the following DAX to add Rank Number

     

    Rank = RANKX(Sold,Sold[Date],,ASC,Dense)

    Then, create another calucated column and use the DAX below to get the cumulative sum in 2 days by item name

    2Days_Sum = CALCULATE(SUM(Sold[Sold]),ALLEXCEPT(Sold,Sold[Item Name]),Sold[Rank]<=EARLIER(Sold[Rank])&&Sold[Rank]>EARLIER(Sold[Rank])-2)