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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
sreddy47652
Helper III
Helper III

Current Vs Previous not working as expected

Hi Team,

I am trying to comparing the current vs Previous year completed values but while writing below dax always returing the same values. How to fix the issues as expected result below. I need unique values for month wise. Please find the below dax expressions and expected result in below.

current_year = CALCULATE([Completed(#)],FILTER(Table1,YEAR(Table1[Year]=YEAR(TODAY()))))

Previous Year1 = var Previous_yearYEAR(TODAY()) return  CALCULATE([Completed(#)],FILTER('Table1',YEAR(Table1[Year])=Previous_year -1))

It's returing the values by using above dax.

sreddy47652_0-1651901860069.png

Expected result is below like this.

sreddy47652_1-1651902017884.png

 

4 REPLIES 4
tackytechtom
Super User
Super User

Hi @sreddy47652 ,

 

Can you provide some sample data or share your file, please? 🙂


Thanks!

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

tackytechtom
Super User
Super User

Hi @sreddy47652 ,

 

I think you are missing the removal of the filter, i.e. by adding an ALL() to your code. Could you try this one?


CALCULATE([Completed(#)], ALL ('Table1')FILTER('Table1',YEAR(Table1[Year])=Previous_year -1))

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

@tackytechtom I tried with this too but it's giving me same results for above and its alwas displaying duplicated values for across all.

Hi @sreddy47652 ,

 

Thanks for sharing the file! Now I can see the problem. In Power Query there were some changes made so the format was altered to a "special currency design":

 

tomfox_1-1652119464219.png

 

PBI has difficulties to translate that back to a number and the only way it can deal with that format is by using it as a texst data type. I could not see the original data in your pbix since it was pointing to csv file, but it seems like you should come further by removing the "Replaced Value" steps:

tomfox_0-1652119361025.png

 

Also, it appears like you will be having the same issue for the Valuation attribute. So remove the replacing steps and try to change the data type to number. If that does not work either you might need to remove all commas and dollar signs so that there are only numbers in your column.

 

Let me know if this works 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors