Forum Discussion

bilalkhokar73's avatar
bilalkhokar73
Helper IV
5 years ago
Solved

Quarter Formula

1. I want dynamic quarter 1 thsi year last year formula,
2. I want to see growth vs degrwoth Q1_Currenteeyar vs Q1LAst year

This formual givign me wrong results , it just displaying values from 8 jan to 8 march

What is worng 

CALCULATE(SUM(Sales[Amt]),FILTER(date,date[Date]>=DATE(YEAR(TODAY()),1,DAY(TODAY()))&& date[Date]<=DATE(YEAR(TODAY()),3,DAY(TODAY()))))

  • no that is date , my typing error

     

    CALCULATE(SUM(Sales[Amt]),FILTER(date,date[Date]>=DATE(YEAR(TODAY()),1,DAY(TODAY()))&& date[Date]<=DATE(YEAR(TODAY()),3,DAY(TODAY()))))

5 Replies

  • Hey bilalkhokar73 ,

     

    I have to admit that I have difficulties understanding your data model, as it seems that there are three tables involved:

    • Sales
    • tm_date
    • date

    Maybe this side provides what you are looking for: Time patterns – DAX Patterns

    If not, please prepare sample data, that still reflects your data model. Upload the pbix to onedrive or dropbox and share the link. If you are using sample Excel to create the sample data, share the xlsx as well.

    Explain the expected result based on the sample data.

     

    Regards,

    Tom

  • bilalkhokar73 

    Can you provide more information as to what you are try to achieve?

    In your formula, what is tm_date? you do not reference it in the filter arguments.

    • bilalkhokar73's avatar
      bilalkhokar73
      Helper IV

      no that is date , my typing error

       

      CALCULATE(SUM(Sales[Amt]),FILTER(date,date[Date]>=DATE(YEAR(TODAY()),1,DAY(TODAY()))&& date[Date]<=DATE(YEAR(TODAY()),3,DAY(TODAY()))))

  • I got solution but here i face one issue when i am making growth degrwoth for quarter 3 , degrwoth shwoing high 

    I need quarter 3 till date , measn quarter 3 start from  1july to 30sept 2020 and 2021, so for 1 july to till date i need quarter 2020 and quarter 2021

    Q32021 = var _max = date(year(today()),9 ,30) var _min = date(year(today()),7 ,1)
    return CALCULATE(sum(sales[Amt]), FILTER(ALL(DATE),DATE[date] >=_min && DATE[date] <= _max) )

    Q32020 = var _max = date(year(today())-1,9 ,30) var _min = date(year(today())-1,7 ,1)
    return CALCULATE(sum(sales[Amt]), FILTER(ALL(DATE),DATE[date] >=_min && DATE[date] <= _max) )


    Q3 20V21% = var _grow=DIVIDE([Q32021]-[Q32020],[Q32020],BLANK())
    return IF([Q32021]>[Q32020],ABS(_grow),-ABS(_grow))