Forum Discussion

pankajdhillon's avatar
pankajdhillon
Frequent Visitor
10 years ago
Solved

TOTALYTD not working

I am using TOTALYTD but no output is coming from it

TOTALYTD(COUNT(BookingDataAir[Bookings]),'DimDate'[full_date])

 

whereas when I use CALCULATE it works fine and gives expected result

CALCULATE(COUNT(BookingDataAir[Bookings]),'DimDate'[full_date])

  • Actually I realized my mistake, my formula was correct but when I was trying to visualize my data I was using date column from my BookingDataAir dataset rather than using them from DimDate dataset and due to that no value was coming for TOTALYTD. 

     

    Thanks everyone for help though.

     

8 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    What if you use:

    TOTALYTD(COUNT(BookingDataAir[Bookings]),'DimDate'​[full_date],ALL('DimDate'))
    • pankajdhillon's avatar
      pankajdhillon
      Frequent Visitor

      Even that works same as TOTALYTD(COUNT(BookingDataAir[Bookings]),'DimDate'​[full_date]) i.e. no output :(

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        What is the context in which you are using that measure?

  • Actually I realized my mistake, my formula was correct but when I was trying to visualize my data I was using date column from my BookingDataAir dataset rather than using them from DimDate dataset and due to that no value was coming for TOTALYTD. 

     

    Thanks everyone for help though.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Question, what are your beginning year dates?  1/1/xx or 12/31/xx

     

    Depending what you are trying to acheive, what I do is that I always want a current YTD kpi on my dashboard.  So I just utilize two different Measures.

    1. Current Count: COUNT(xxxx)

    2. Beginning of year count: OPENINGBALANCEYEAR(xxxx)

    3.  Take 1 mins 2 and

     

    This also assumes your data is accumulative in nature. 

    • pankajdhillon's avatar
      pankajdhillon
      Frequent Visitor

      Even OPENINGBALANCEYEAR(COUNT(BookingDataAir[Bookings]),DimDate[full_date]) is giving me no result.

  • fbrossard's avatar
    fbrossard
    Kudo Commander

    Hi pankajdhillon

     

    Do you use PBI Desktop as designer ?

    If yes, you should know that in PBI Dekstop you can't mark table as date. To use time functions you should define you relationships between factTables/DimDate by using a date or dateime column.

    Thus your TOTALYTD will work.