Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
LeaRupnik
Helper III
Helper III

Compar of the current year with the previous year

i have a problem how to comer a previous year and current year. In current year (2020) a don't have all data. 

If I do this like manual selection in filter is ok. now I would like to do automatically with measure. 

if a do like this  a get just year 2019 and 2018.

 

sum pak prejemnik SY/PY =
var b =YEAR(NOW())-1
Return
CALCULATE(SUM('DW PAKIRANO'[IZDKOL]);FILTER('DW CAS';YEAR('DW CAS'[DATUM])=b||YEAR('DW CAS'[DATUM])=b-1);ALLEXCEPT('DW PAKIRANO';'DW PAKIRANO'[komitent_prejemnik]))
 
I youd like to get like this: 
 
Screenshot_4.png 
4 REPLIES 4
v-diye-msft
Community Support
Community Support

Hi @LeaRupnik 

 

you might consider creating pbix file that will contain some sample data (remove the confidential info), upload the pbix to onedrive for business and share the link to the file. Please do not forget to describe the expected results based on this sample data.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

thanks for the information  @Greg_Deckler and @v-diye-msft  

Now I do the same test which is attached.  

I would like to get just a year 2019 and 2020. 

 

usp=sharinghttps://drive.google.com/file/d/18ysEkcwUZ50DtafHcIKCMDrbguou8xwI/view?usp=sharing 

 

Thanks, 

Lea

thanks for the information. 

Now I do the same test which is attached.  

I would like to get just a year 2019 and 2020. 

 

usp=sharinghttps://drive.google.com/file/d/18ysEkcwUZ50DtafHcIKCMDrbguou8xwI/view?usp=sharing 

 

Thanks, 

Lea

Greg_Deckler
Super User
Super User

In general, you use TOTALYTD to get the current year and then use SAMEPERIODLASTYEAR for last year. 

 

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors