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

DAX Column Unaffected by Slicer or Filter pane

Hi all,

 

I have a problem where a calculated DAX column does not respond to filtering. The same issue presents itself if I try to circumvent with a measure instead. The dax column/measure are required to obtain a cumulative/running total value of revenue. 

 

A simplified sample of the data is below. I am trying to filter the column based on the Sector in a slicer. Sector ID is used to form a relationship to a bridge table, but I still cannot filter the dax column even while using the sector column from this same table, or if I disable the relationship. 

 

Date Monthly Revenue 18-19SectorSector ID
01/01/2020£20000Government1
01/01/2020£30000Government1
02/02/2020£15000Charities2
02/02/2020£10000Charities

2

 

The DAX is as follows:

 

Monthly Rev 18-19 Running Total =
CALCULATE (
SUM ( '4 Rev18-19 (2)'[Monthly Revenue 18-19] ),
ALL ( '4 Rev18-19 (2)' ),
'4 Rev18-19 (2)'[Date] <= EARLIER ( '4 Rev18-19 (2)'[Date] )
)
 
Have I written the DAX in a way that it is always going to ignore Filters? If so, it would be amazing if someone could point me towards how I could achieve the cumulative total result in a way where it can be filtered via a slicer.
1 ACCEPTED SOLUTION

Hi @AndyB 

 

I think you should refer to below measure:

Monthly Rev 18-19 Running Total measure = CALCULATE(SUM(Table2[Monthly Revenue 18-19]),FILTER(ALLSELECTED(Table2),[DateAdd (Year)]<=MAX(Table2[DateAdd (Year)]))
)

07.PNG

Pbix attached. 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

6 REPLIES 6
mahoneypat
Employee
Employee

You can do a running total measure instead like this one.  Try it in a table visual with the date column.  Since the ALL is changed, it should only remove the filter from that column (e.g., slicers on Sector, etc. should still work).  If you make a Month column in your table, and add that to your visual, you should see the Month running total.

 

Rev 18-19 Running Total =
VAR thisdate =
MIN ( '4 Rev18-19 (2)'[Date] )
RETURN
CALCULATE (
SUM ( '4 Rev18-19 (2)'[Monthly Revenue 18-19] ),
ALL ( '4 Rev18-19 (2)'[Date] ),
'4 Rev18-19 (2)'[Date] <= thisdate
)
 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi @mahoneypat

Thanks very much for taking the time to send over that measure.

The measure worked in the sense that filters now work correctly, however, it unfortunately seems to be showing the same values as the monthly revenue field as opposed to the cumulative/running total I am looking to show. (I did try the below with only the date, and "Pats Measure" in the table also)

Any ideas you might have that may have caused this I would be really grateful!

Screenshot.png

Hi @AndyB 

 

I think you should refer to below measure:

Monthly Rev 18-19 Running Total measure = CALCULATE(SUM(Table2[Monthly Revenue 18-19]),FILTER(ALLSELECTED(Table2),[DateAdd (Year)]<=MAX(Table2[DateAdd (Year)]))
)

07.PNG

Pbix attached. 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Hi @v-diye-msft 

 

Thank you so much! That worked perfectly, and helped me with the final requirement I had for this report - very much appreciate it!

 

Thanks to all for your help.

 

amitchandak
Super User
Super User

@AndyB , you are using all this why it is ignoring the filter.

Also if it is a column, it will not respond to slicer changes.

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Hi @amitchandak 

 

Thanks very much for a quick response. 

 

Do you know of any other way I could achieve a running total without using the all function?

 

Sure, I have made a sample report with the sectors and values substituted.

 

Unfortunately it seems I don't have access to attach things to my posts, so I have provided a link to the pbix in google drive here.

 

Link to a sample excel sheet also here.

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.