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
Anonymous
Not applicable

Calculated Column is not working with report filters

Hi Everyone,

     I have a pie chart that displays the hours spent on different projects. Because there are a lot of projects, I created a new column that displays the names of the first 10 projects that has the top hours and then group the remaining as 'Other Projects".

      I have this DAX that gave me the desired result, however, I noticed when I apply a filter from another chart, this doesnt seems to work well.

For instance, if I select a filter that will return like 4 pies and these pies should show the names of all the 4 projects since they are just four of them. However, this will show the 3 projects and the fourth one will be showing "Other Projects".

Project Group = 
IF (
	CONTAINS ( 
		TOPN (
			10,
			SUMMARIZE ( 
				'Projects',
				[Project Name],
				"Total Hours",
				SUM ( 
				'Projects'[Hours]
				)
			),
			[Total Hours]
		),
		'Projects'[Project Name],
		'Projects'[Project Name]
	) = TRUE (),
	[Project Name],
	"Other Projects"
)

 

Please I need someone to help me review the DAX to see what I am missing.

 

Thanks!

4 REPLIES 4
Greg_Deckler
Super User
Super User

@Anonymous - Calculated columns are not dynamic based upon report filters, etc. They are not recalculated based upon user interaction. I think this is your issue if I am following this correctly.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Yes, they are not dynamic

Hi @Anonymous,

In fact, filter/slicer and calculate columns are at different data levels. The source table that filter/slicer is generated from data model tables that calculated fields hosted. 

Notice: data level from parent to child, the child not able to affect their parent level.

query table(query, query parameter, custom function...) -> data model table(calculate table, calculate column, RLS) -> date view table (measure, slicer, filter)

So if you want to create a dynamic calculated column/table, you need to use the high-level filter than data model tables.
For example, you can create a query parameter and turn on the 'enable load' option to save it as a query table. Then your table can interact and calculate with the generated query parameters table values. (you can change the query parameter to change the query parameter table to indirect change the calculated table results)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.