Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
alespooletto
Creator
Creator

Obtain calculated columns for current year, current month, last year

The table I am working with is very simple, it literally has only the name of the office, and the sum of its orders in total.

alespooletto_0-1708528637269.png

 

 

I want to make some columsn that give me, the Net IO for the whole year until now, for the current month ,and for the current year. Are the functions YTD() available in power BI usable in the same way here? And if they do, how can I change the name of the column to show it's only for the specific period of time?

 

Thank you!

Labels (1)
4 Replies
LRuCelver
Partner - Creator III
Partner - Creator III

Assuming the current Date is the max. Date you can use these set analyses to create the values:

YTD: {<DateField={">=$(=YearStart(DateField))"}>}

PYTD: {<DateField={">=$(=YearStart(AddYears(DateField, -1))) <$(=YearStart(DateField))"}>}

MTD: {<DateField={">=$(=MonthStart(DateField))"}>}

alespooletto
Creator
Creator
Author

Thank you for the response. Is it possible to put these formulas directly into the Load Editor script? 

LRuCelver
Partner - Creator III
Partner - Creator III

No. Set Analysis can only be used if charts.

If you want to calculate these measures in the script you would have to aggregate by the year/month and only keep the relevant results.

alespooletto
Creator
Creator
Author

Thanks for the information. 

I am trying to use the information you sent me, it seems like there is an issue. 

alespooletto_0-1708530598536.png

 

If I understand correctly, I changed the DateField with the one I want, and the YearStart is a function, but it seems like this one won't work. It gives me this error:

alespooletto_1-1708530639306.png

 

Thanks for the patience