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
Falongi_82
Helper I
Helper I

How to have a percentage Box evolution in my report based on slicer YEAR?

Hi all,

 

I'm facing to one difficulty to find, how can I display a correct percentage evolution by Year based on my YEAR selection (SLICER).

If I selectect consecutive year, my measure works well.

If I select non-consecutive years, the result is no longer correct with what I display 😞

I know the problem is my measure but I don't find how to adapt it.

 

See below :

 

Ok when Year selected are consecutive

Falongi_82_0-1674650436676.png

 

Not ok in this case, Year not consecutive :

Falongi_82_1-1674650587874.png

 

My measure :

 

M_PY_BOX % = 
VAR PY = CALCULATE([M_BOX];DATEADD(T_CALENDAR[DATES];-1;YEAR))
RETURN
IF(ISEMPTY(PREVIOUSYEAR(T_CALENDAR[DATES]));"-";DIVIDE(([M_BOX]-PY);PY;0))

 

Thx in advance for your help and clarifcation.

R/

Fabrizio 

3 REPLIES 3
Falongi_82
Helper I
Helper I

Small Up,

Any Idea

Thx in advance for your help

pratyashasamal
Super User
Super User

Hi @Falongi_82 ,
This is happening because the slicer is removing the required previous year from the dataset that measure is using to calculate on . So you can us ALL() or REMOVEFILTER() function with your Date fields in your calculation .
You can refer to these links :-
https://learn.microsoft.com/en-us/dax/all-function-dax

https://learn.microsoft.com/en-us/dax/removefilters-function-dax
Hope this was helpful.

Thanks ,
Pratyasha Samal
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thx for your reply but not very clear for me 😞

I want just to adapt my following measure to display when I choose for exemple 2019/2021/2023 the good evolution based on my selection and not based on My previous Year (Year-1)

 

Falongi_82_0-1674721294418.png

M_PY_BOX % = 
VAR PY = CALCULATE([M_BOX];DATEADD(T_CALENDAR[DATES];-1;YEAR))
RETURN
IF(ISEMPTY(PREVIOUSYEAR(T_CALENDAR[DATES]));"-";DIVIDE(([M_BOX]-PY);PY;0))

 

Thx

Fabrizio

 

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.