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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
abigail11
Regular Visitor

Keeping some page filters but not month selection

I currently have the measure below which calculates the cumulative total of target hours, displayed in a line chart. My issue is when the page is filtered on a specific month, for example January - as other visualisations on the page require this - the line chart updates to only show January, whereas I need it to continue to show the full year through to December regardless of the selected filter value. It is worth noting I have other slicers / filters on the page which I need to keep impacting this chart.
 
Any help would be very much appreciated - I'm pretty new to PowerBI!
 
Cumulative Target =
   CALCULATE(
        SUM('Hours'[Target Hours]),
       filter(ALLSELECTED('Hours'),'Hours'[Month] <= MAX('Hours'[Month]))
)
1 ACCEPTED SOLUTION
v-linhuizh-msft
Community Support
Community Support

Hi @abigail11  , 

 

I tried to use a sample data myself based on your requirement and implemented the result. Please check if there is anything that can be improved. Here are the steps:

 

1.Load example data for demonstration:

 

vlinhuizhmsft_0-1721893518499.png

 

2.Create a line chart visual and measure:

vlinhuizhmsft_1-1721893542224.png

 

 

 

measure = 
CALCULATE(SUM(financials[ Sales]),FILTER(ALLSELECTED(financials),'financials'[Month Number] <= MAX('financials'[Month Number])))

 

 

 

3.Creating a new table based on the month field avoids the need to perform filtering operations on line charts as well, by using the month in that table as a slicer field for other visuals.

 

vlinhuizhmsft_0-1721893617834.png

 

4.When using other visuals, the following dax code can be written to create the measure, which will use the month of the new table:

 

 

 

Measure 2 = 
CALCULATE(SUM(financials[COGS]),FILTER(ALLSELECTED(financials),'financials'[Month Number] = SELECTEDVALUE('Table'[Month Number])))

 

 

 

4. The final  results obtained are as follows:

·111.png.222.png

 

Best Regards,
Zhu
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

1 REPLY 1
v-linhuizh-msft
Community Support
Community Support

Hi @abigail11  , 

 

I tried to use a sample data myself based on your requirement and implemented the result. Please check if there is anything that can be improved. Here are the steps:

 

1.Load example data for demonstration:

 

vlinhuizhmsft_0-1721893518499.png

 

2.Create a line chart visual and measure:

vlinhuizhmsft_1-1721893542224.png

 

 

 

measure = 
CALCULATE(SUM(financials[ Sales]),FILTER(ALLSELECTED(financials),'financials'[Month Number] <= MAX('financials'[Month Number])))

 

 

 

3.Creating a new table based on the month field avoids the need to perform filtering operations on line charts as well, by using the month in that table as a slicer field for other visuals.

 

vlinhuizhmsft_0-1721893617834.png

 

4.When using other visuals, the following dax code can be written to create the measure, which will use the month of the new table:

 

 

 

Measure 2 = 
CALCULATE(SUM(financials[COGS]),FILTER(ALLSELECTED(financials),'financials'[Month Number] = SELECTEDVALUE('Table'[Month Number])))

 

 

 

4. The final  results obtained are as follows:

·111.png.222.png

 

Best Regards,
Zhu
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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