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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Jkh30
Helper I
Helper I

ALL Function doesn't work

Hi,

 

I have a table like this:

DateValueYearMonthMonth No
01-Jan-22102022January1
01-Jan-23202023January1
01-Feb-22302022February2
01-Feb-23102023February2

 

And my requirement is to show all the year of the data from date range selection, for example if I choose the date between 01-01-2022 until 28-02-2022. The chart should show two lines, which the January and February of 2022 and 2023. I tried to use ALL to exclude the date but it's still filtering like this:

Jkh30_0-1690188815479.png

Measure = CALCULATE(SUM(Sheet1[Value]),ALL(Sheet1[Date]))

 

The visual is not showing the data of year 2023. The expected result is to show all the years.

 

 

Any help would be so appreciated. Thank you!

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi , @Jkh30 

According to your description, you want just filter the Months in your slicer and show all the year.

For your need , here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1690340364519.png

(2)For your need , we can not use the [Date] in the fact table as the slicer , we need to create a dimension date table like this:(this is a calculated table ,we can click "New Table" and enter this to create )

Date = ADDCOLUMNS( CALENDAR(DATE(2021,1,1) ,DATE(2023,12,31)) ,"Year" , YEAR([Date]),"Month", FORMAT([Date],"mmmm") , "Month No" ,  MONTH([Date]) )

 

 

(3)Then we can create a measure like this:

Measure = var _slicer= VALUES('Date'[Month No])
var _year = MAX('Table'[Year])
var _month = MAX('Table'[Month No])

return
IF( _month in  _slicer , SUM('Table'[Value]),BLANK())

 

(4)Then we can put the 'Date'[Date] as the slicer and put the fields on the visual and then we can meet your need:

vyueyunzhmsft_1-1690340488680.png

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.