<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic DAX percentage over hierarchy - my column totals are not respecting the column filter context in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-percentage-over-hierarchy-my-column-totals-are-not/m-p/3161662#M113571</link>
    <description>&lt;P&gt;I have a matrix with a row hierarchy - the parent field is Team Leader and the child is Agent. The values are [Number of Coachings] and the columns are [YearMonth]. All my data is in a single table so there are no data model relationships.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I have created a measure to capture the percentage of coachings over hierarchy - when it is an agent row I want the percentage of the total coachings of that agent, when it is a team leader I want the percentage of all the team leaders, but only for that YearMonth column. My formula is calculating the percentage of all columns and I cannot figure out how to modify it to make it functional.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The measure formula - (Variable X contains all my report slicers)&lt;/P&gt;&lt;PRE&gt;% Parent By Agent = 

VAR x = ALLEXCEPT(Query1, Query1[Team Leader],Query1[JobStatus], Query1[DepartmentGroup], Query1[DaysSinceHire], Query1[NewAgent_Current], Query1[YearMonth])

VAR Scope_Agent = CALCULATE(COUNT(Query1[Feedback_Title]),x,Query1[Team Leader] = VALUES(Query1[Team Leader]))

VAR Scope_TL = CALCULATE(COUNT(Query1[Feedback_Title]),ALLSELECTED(Query1))

RETURN

SWITCH(

TRUE()

// Agent rows  
ISINSCOPE(Query1[Agent]), DIVIDE(COUNT(Query1[Feedback_Title]), Scope_Agent), 

//Team Leader rows
ISINSCOPE(Query1[Team Leader]), DIVIDE(COUNT(Query1[Feedback_Title]), Scope_TL), 

//Grand Total row
, DIVIDE(COUNT(Query1[Feedback_Title]), Scope_TL))&lt;/PRE&gt;&lt;P&gt;It works when I filter on 1 YearMonth column, but if I select more than 1 YearMonth values, the percentage is calculated over all columns.&lt;BR /&gt;&lt;BR /&gt;&lt;IMG border="0" /&gt;&lt;IMG border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I modify so that the formula calculates on the column filter context for all hierarchy levels? I want each level of the hierarchy for each YearMonth column to add up to 100%. Currently the child percentage adds up to 100% per column but the parent percentage is calculating on the time period in the slicer, not on the matrix column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Apr 2023 15:29:39 GMT</pubDate>
    <dc:creator>alexandrast</dc:creator>
    <dc:date>2023-04-04T15:29:39Z</dc:date>
    <item>
      <title>DAX percentage over hierarchy - my column totals are not respecting the column filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-percentage-over-hierarchy-my-column-totals-are-not/m-p/3161662#M113571</link>
      <description>&lt;P&gt;I have a matrix with a row hierarchy - the parent field is Team Leader and the child is Agent. The values are [Number of Coachings] and the columns are [YearMonth]. All my data is in a single table so there are no data model relationships.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I have created a measure to capture the percentage of coachings over hierarchy - when it is an agent row I want the percentage of the total coachings of that agent, when it is a team leader I want the percentage of all the team leaders, but only for that YearMonth column. My formula is calculating the percentage of all columns and I cannot figure out how to modify it to make it functional.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The measure formula - (Variable X contains all my report slicers)&lt;/P&gt;&lt;PRE&gt;% Parent By Agent = 

VAR x = ALLEXCEPT(Query1, Query1[Team Leader],Query1[JobStatus], Query1[DepartmentGroup], Query1[DaysSinceHire], Query1[NewAgent_Current], Query1[YearMonth])

VAR Scope_Agent = CALCULATE(COUNT(Query1[Feedback_Title]),x,Query1[Team Leader] = VALUES(Query1[Team Leader]))

VAR Scope_TL = CALCULATE(COUNT(Query1[Feedback_Title]),ALLSELECTED(Query1))

RETURN

SWITCH(

TRUE()

// Agent rows  
ISINSCOPE(Query1[Agent]), DIVIDE(COUNT(Query1[Feedback_Title]), Scope_Agent), 

//Team Leader rows
ISINSCOPE(Query1[Team Leader]), DIVIDE(COUNT(Query1[Feedback_Title]), Scope_TL), 

//Grand Total row
, DIVIDE(COUNT(Query1[Feedback_Title]), Scope_TL))&lt;/PRE&gt;&lt;P&gt;It works when I filter on 1 YearMonth column, but if I select more than 1 YearMonth values, the percentage is calculated over all columns.&lt;BR /&gt;&lt;BR /&gt;&lt;IMG border="0" /&gt;&lt;IMG border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I modify so that the formula calculates on the column filter context for all hierarchy levels? I want each level of the hierarchy for each YearMonth column to add up to 100%. Currently the child percentage adds up to 100% per column but the parent percentage is calculating on the time period in the slicer, not on the matrix column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 15:29:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-percentage-over-hierarchy-my-column-totals-are-not/m-p/3161662#M113571</guid>
      <dc:creator>alexandrast</dc:creator>
      <dc:date>2023-04-04T15:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: DAX percentage over hierarchy - my column totals are not respecting the column filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-percentage-over-hierarchy-my-column-totals-are-not/m-p/3166772#M113920</link>
      <description>&lt;P&gt;something like this?&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2023 00:54:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-percentage-over-hierarchy-my-column-totals-are-not/m-p/3166772#M113920</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-04-01T00:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: DAX percentage over hierarchy - my column totals are not respecting the column filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-percentage-over-hierarchy-my-column-totals-are-not/m-p/3169629#M114207</link>
      <description>&lt;P&gt;It works, thank you so much!&lt;BR /&gt;Such a simple statement, too.&lt;BR /&gt;&lt;BR /&gt;Would it be possible to explain why this works? I don't understand how REMOVEFILTERS does not remove the slicer or report-level filters, and how it does not remove the column context.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 14:14:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-percentage-over-hierarchy-my-column-totals-are-not/m-p/3169629#M114207</guid>
      <dc:creator>alexandrast</dc:creator>
      <dc:date>2023-04-03T14:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: DAX percentage over hierarchy - my column totals are not respecting the column filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-percentage-over-hierarchy-my-column-totals-are-not/m-p/3169716#M114214</link>
      <description>&lt;P&gt;I used REMOVEFILTERS only against the specified column. All other filters remain intact.&amp;nbsp; That is a technique sometimes called "filtering up".&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 14:46:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-percentage-over-hierarchy-my-column-totals-are-not/m-p/3169716#M114214</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-04-03T14:46:17Z</dc:date>
    </item>
  </channel>
</rss>

