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.
Hi all,
Hoping to get some help on this if anybody has dealt with something similar to the below before
My pbix file grabs data from SQL and populates a matrix. The data source is a few million rows of data. We are looking to measure year on year performance for certain products and combinations of factors which go into purchasing. I have two core issues which I am trying to solve:
The pbix works as per below:
Revenue Variance = [Revenue This Year] - [Revenue Last Year]
Revenue Last Year =
CALCULATE ( [Total Revenue], FILTER ( ALL ( dt_Example[Fin Year] ), dt_Example[Fin Year] = MAX ( dt_Example[Fin Year] ) - 1 ) ) -- and "This Year" is identical except without the - 1
I have put together an ultra simplified dummy data set to demonstrate what is happening. The output looks like the below:
I am able to solve the red issue by changing the layout of matrix (removing year column indicator, replacing revenue data with calculated fields), however this creates a new problem:
If any clarification or the dummy pbix file is required, please just let me know what you need (or where to upload the pbix to)
Thanks in advance,
Zane
Solved! Go to Solution.
Hi @Anonymous ,
Whether the field "Fin Year" is a date type, if so, try replacing dt_Example[Fin Year] with dt_Example[Fin Year].Year or you can try the following measure:
Revenue Last Year = VAR __maxyear = CALCULATE ( MAX ( dt_Example[Fin Year] ), ALLSELECTED ( dt_Example[Fin Year] ) ) RETURN CALCULATE ( [Total Revenue], FILTER ( ALL ( dt_Example[Fin Year] ), dt_Example[Fin Year] = __maxyear - 1 ) )
-- and "This Year" is identical except without the – 1
Here is a demo, please try it:https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EfBDCAIS2JdJoyTrqbhtOuQBph12pEqzdb0p57qXMWXJoQ?e=bZSlRo
Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Whether the field "Fin Year" is a date type, if so, try replacing dt_Example[Fin Year] with dt_Example[Fin Year].Year or you can try the following measure:
Revenue Last Year = VAR __maxyear = CALCULATE ( MAX ( dt_Example[Fin Year] ), ALLSELECTED ( dt_Example[Fin Year] ) ) RETURN CALCULATE ( [Total Revenue], FILTER ( ALL ( dt_Example[Fin Year] ), dt_Example[Fin Year] = __maxyear - 1 ) )
-- and "This Year" is identical except without the – 1
Here is a demo, please try it:https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EfBDCAIS2JdJoyTrqbhtOuQBph12pEqzdb0p57qXMWXJoQ?e=bZSlRo
Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks Joey
I went with the VAR solution in this instance
Appreciate the help!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |