Forum Discussion

FrugalEconomist's avatar
FrugalEconomist
Icon for Helper III rankHelper III
9 years ago
Solved

Shifted Start Date with Year to Date Since Inception

Dear Power BI Community,

 

I would like to shift my starting day for a Year to Date Since Inception graph. Ideally, the visualization would start in January 2014, with the starting values (e.g. 3266, 1633, 688) [Left Image]. However if I add a date slicer, it loses all the earlier data and start cumulating at the slice day [Right Image]

 

So my goal is to get the [Left Image] without all the year data before 2014. Thank you.

  • v-sihou-msft's avatar
    v-sihou-msft
    9 years ago

    FrugalEconomist

     

    In this scenario, when you apply the slicer, the table context will start from Jan 2014, so your YTD calculation before Jan 2014 will be truncated. For your requirement, you can add a calculated column for this YTD calculation. Then you can filter your chart with expected YTD values.

     

    =ADDCOLUMNS(Query1,"Total Inquiries",TOTALYTD(SUM(Query1[NumberOfInquries]),Query1[PreAdmitDate].[Date],ALL(Query1[PreAdmitDate])))
    

     

     

    Regards,

4 Replies

  • dkay84_PowerBI's avatar
    dkay84_PowerBI
    Icon for Microsoft Employee rankMicrosoft Employee

    What measure are you using to calculate your lines?  It looks like you have some sort of filter context applied so that when you use a slicer, it aggregates the data incorrectly.

    • FrugalEconomist's avatar
      FrugalEconomist
      Icon for Helper III rankHelper III

      I think my measures are okay. The graph appear to be good, it's just hard to interpret and make month-to-month comparisons.

       

      This is my measure.

       

      Total Inquiries: = TOTALYTD(SUM(Query1[NumberOfInquries]),Query1[PreAdmitDate].[Date],ALL(Query1[PreAdmitDate]))

       

       

      • v-sihou-msft's avatar
        v-sihou-msft
        Icon for Microsoft Employee rankMicrosoft Employee

        FrugalEconomist

         

        In this scenario, when you apply the slicer, the table context will start from Jan 2014, so your YTD calculation before Jan 2014 will be truncated. For your requirement, you can add a calculated column for this YTD calculation. Then you can filter your chart with expected YTD values.

         

        =ADDCOLUMNS(Query1,"Total Inquiries",TOTALYTD(SUM(Query1[NumberOfInquries]),Query1[PreAdmitDate].[Date],ALL(Query1[PreAdmitDate])))
        

         

         

        Regards,

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi 

     

    There no prob in your measure thats fine.

     

    The prob in Date filter , may i know where the date filter coming from ? it is belong to same table or any other table like date master.

     

    i think it is coming from date master.

     

    If yes , check the dates range in date master .

     

    let me know any further help