Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

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.

Expected result is below like this.

 

4 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

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

      • tackytechtom's avatar
        tackytechtom
        Icon for Most Valuable Professional rankMost Valuable Professional

        Hi Anonymous ,

         

        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":

         

         

        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:

         

        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/