Skip to content
Advertisement

Sum and Count by month, shown with last day of that month

I have a transaction table like this:

I need to sum amount and count transactions by year and month. I tried this:

It works like charm. However, I will use this data on PowerBI thus I cannot show these results in a “line graphic” due to the year and month info being in separate columns.

I tried changing format on SQL to 'YYYYMM' alas powerBI doesn’t recognise this column as date.

So, in the end, I need a result table looks like this:

I have tried several little changes with no result.

Help is much appreciated.

Advertisement

Answer

You may try with the following statement:

Result:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement