Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi All
Does PBI allow us to create a expression that compute 2020 sales amount , i mean even user filter year=2021 , that expression will still display 2020 sales.
Paul
Solved! Go to Solution.
Yes there is that's exactly what ALL is for, it removes any filters .
Here's a link to your PBIX file - check the Measure/Card I created.
regards
Phil
Proud to be a Super User!
Hi Paul,
I just realised that @v-deddai1-msft already answered your question and I just posted the same thing. My bad, this new forum layout is confusing.
Looking at the image you posted you are missing the ALL() in the measure.
Just copy/paste this code rather than typing it out.
This is what should work and does work for me in your PBIX file
SALES_IN_2020 = CALCULATE( SUM(SALES[sales]),FILTER(ALL('Date'),'Date'[Year] = 2020))
Regards
Phil
Proud to be a Super User!
Hi Philip
I think now i am convince that PBI is not allow to have expression that will not affected when user set filter . i mean if user set year filter =2019 , there is no way any expression can display 2020 sales amount.
Paul
Yes there is that's exactly what ALL is for, it removes any filters .
Here's a link to your PBIX file - check the Measure/Card I created.
regards
Phil
Proud to be a Super User!
Hi Paul,
Sorry I couldn't get the download from Dropbox, I kept getting an error.
To do what you want you need to use ALL('Date') to remove the slicer filters for Year
Try this
SALES_IN_2020 = CALCULATE( SUM(SALES[sales]),FILTER(ALL('Date'),'Date'[Year] = 2020))
Regards
Phil
Proud to be a Super User!
Hi Phil
I just try , when i use your expression , when i select year =2019 , the sales amount dis-appear.
Above link is my PBI file
Paul
Hi @admin11 ,
I can't get your pbix file from your link. Would you please share it again.
There are many ways to filter data for 2020. You'd better have a date table , and you can set a slicer or page level filter.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi Deddai
Above is my PBI file
Paul
Hi @admin11 ,
You can fix filter in the formula:
SALES_ = CALCULATE( SUM(SALES[sales]),FILTER(all('Date'),'Date'[Year] = 2020))
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi All
Your expression work fine , when i dont filter year , but when i select year = 2019 , it display blank. what i need is even when user filter year=2021 , the display still can display 2020 sales amount.
Hi Paul,
The short answer would be yes.
But need to see data to do it for you.
regards
Phil
Proud to be a Super User!
Hi Phil
Above is my PBI file
Paul
Hi Paul,
Sorry I've only just seen this. I didn't know you'd replied.
When you reply you need to @ mention people so they get notified.
When typing your reply just type the @ symbol and a list of names will appear for those who have responded in the thread. Click on the one(s) you want to notify that you've replied.
I can't access your file, Dropbox says it's been deleted.
regards
Phil
Proud to be a Super User!
Above link is my PBI file
Paul
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
88 | |
86 | |
83 | |
65 | |
49 |
User | Count |
---|---|
127 | |
108 | |
88 | |
70 | |
66 |