Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
ngreddy1982
Contributor III
Contributor III

Group by is not working

Hi All, 

I am trying to do group by Year which is derived from Date, for some reason, it is not working as expected, getting the same number of rows with date Vs Year. Please advice how can i group the below by Year


TestStg:

LOAD
 BrachNumber
,Date(Date#(SoldDateKey,'YYYYMMDD'),'YYYY') AS [SoldDateYear]
,SUM([Unbundled Charge Total Amount]) AS [Unbundled Charge Total Amount]

From Sale.QVD (qvd)

GROUP BY
BrachNumber
,Date(Date#(SoldDateKey,'YYYYMMDD'),'YYYY');

Thank you

Labels (2)
2 Replies
Or
MVP
MVP

Neither Date#() nor Date() change the underlying (numeric) date value, only the way it is formatted. If you're trying to isolate the year from a date try Year(Date) instead. Alternatively, pick out the left(Date,4) from your original text value.

ngreddy1982
Contributor III
Contributor III
Author

Hi,

can you please explain with an example?