Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

YTD in Matrix Table

Hi

 

I am trying to use YTD in a Matrix table.

 

On the Y Axis, I have Main product Group, Product Group and Product.

On the X Axis I have the Years.

 

The Problem I am currently facing is to add YTD on the X Axis for each year. Any suggestions how to solve this issue?

 

Thanks in Advancce!

 

kind regards

Jonas

 

3 Replies

  • Anonymous , what to mean by ytd here, each year only till April ?

    For that create a date table, join date of date with order date. Add year to date table and use that year in visual

     

    Create measure like

    YTD Corrected =
    var _max = format(today(),"MMDD")
    return
    calculate(Sum('Table'[AmountNoavt]),DATESYTD('Date'[Date]),format('Date'[Date],"MMDD")<=_max)

    or
    YTD Corrected =
    var _max = format(today(),"MMDD")
    return
    if(format(max('Date'[Date]),"MMDD")<=_max, calculate(Sum('Table'[AmountNoavt]),DATESYTD('Date'[Date])),blank())

     

    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi

     

    Yes, I with YTD I mean the period for each year:

    1.1.2021 - 30.04.2021

    1.1.2020 - 30.04.2020

    1.1.2020 - 30.04.2019

    .....

     

    However I am quite confused about the date table with your comment:

    "For that create a date table, join date of date with order date. Add year to date table and use that year in visual"

     

     

    Im not really sure what needs to be in that date table. I have created something like that but I doubt that this is correct:

     

    Date = SUMMARIZE('Lian CH$Sales Invoice Line','Lian CH$Sales Invoice Line'[Order Date].[Date], 'Lian CH$Sales Invoice Line'[Order Date].[Year],'Lian CH$Sales Invoice Line'[Order Date].[Month],'Lian CH$Sales Invoice Line'[Order Date].[Day])