Forum Discussion

veemo's avatar
veemo
Frequent Visitor
9 years ago
Solved

TOTALYTD not working as expected

Hello everyone,   I'm new to PowerBi and DAX so please bear with me.   Here's an example of the table I'm working on   Now, I would like to calculate TOTALYTD so this is what I write in D...
  • veemo's avatar
    9 years ago

    I solved it

     

    I created a Date Table using http://www.mattmasson.com/2014/02/creating-a-date-dimension-with-a-power-query-script/

     

    Set the relationship with the date entry on my original table and then used the Date Table in DAX as

     

    TOTALYTD(SUM(PowerBI_VenditePerGgCittaFamTipocli[Importo]); DateTableM[Date]; all(DateTableM[Date]))

     

    I honestly do not know why it worked, I guess DAX needs to have a complete date/time reference to make calculations?

     

    Anyway, good to know. That Power query script sure looks useful