Forum Discussion

Mokhtar's avatar
Mokhtar
Frequent Visitor
6 years ago
Solved

Difference Between Quarter display wrong values

Dear Power BI Comunity,

I want to calculate the difference between two dates in quarters.

However I'm getting a woring values below a screenshot,

 

Thanks in advance,

  • Hi Mokhtar , 

    I think you could refer to az38 ' s suggestions to check whether you set aggregation on column

     Or you could try below expression 

    Column = 'Table'[end].[QuarterNo]-'Table'[start].[QuarterNo]

    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

  • az38's avatar
    az38
    Community Champion

    Hi Mokhtar 

    are you sure you do nt have any aggregation for datediff column in visual settings? Set "Do not aggregate"

  • dax's avatar
    dax
    Community Support

    Hi Mokhtar , 

    I think you could refer to az38 ' s suggestions to check whether you set aggregation on column

     Or you could try below expression 

    Column = 'Table'[end].[QuarterNo]-'Table'[start].[QuarterNo]

    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Mokhtar's avatar
      Mokhtar
      Frequent Visitor

      Hello,

       

      Thanks for the answer. It was because of the aggregation.

       

      Regards,

      Mokhtar

  • Hi Mokhtar ,

     

    Your result looks correct according to your DAX used. You are returning difference between 2 dates in QUARTER. Therefore the result is 1. Because 30 Dec 2019 is 1 Quarter before 15 Mar 2020.

    If you want the difference between 2 dates in Months, Days, etc., you need to chnage the 3rd paratmeter in your DATEDIFF functions.

    Refer the following link for the same:

    https://docs.microsoft.com/en-us/dax/datediff-function-dax

     

    If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

     

    Thanks,

    Pragati