<?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 Re: How to divide with a higher hierarchy group in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2777423#M86751</link>
    <description>&lt;P&gt;I don't think that's the solution I am looking for. Or it doesn't give me the results I want. mainly I dont understand why do I treat as the column state in D_cities and D-state column state? And should't the &lt;EM&gt;&lt;STRONG&gt;treatas&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;be in the filter of the first variable, the c&lt;EM&gt;ityValue?&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Sep 2022 11:01:54 GMT</pubDate>
    <dc:creator>ngutc</dc:creator>
    <dc:date>2022-09-19T11:01:54Z</dc:date>
    <item>
      <title>How to divide with a higher hierarchy group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2766209#M85914</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have these tables&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Relationships&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want is to group values by state and get these results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Sure, I can just put the column into the required fields. But I want to use these values for a calculation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;That would be Values in &lt;STRONG&gt;Facts Table 2 (F_state)&lt;/STRONG&gt; divide with values in &lt;STRONG&gt;Facts table 1 group (F_city).&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;For example &lt;STRONG&gt;first line&lt;/STRONG&gt; in &lt;STRONG&gt;Facts Table 2&lt;/STRONG&gt; &amp;gt; The value with the first line in&amp;nbsp;&lt;STRONG&gt;Facts table 1 group &lt;/STRONG&gt;value.&lt;/P&gt;&lt;P&gt;calculation = 985/21368&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't figure out how to do that with a DAX calculation. How to include the higher hierarchy in the calculation. Or if it's possible even.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;calc =&lt;/P&gt;&lt;P&gt;var state = Calculate(SUM(F_state[Value]))&lt;/P&gt;&lt;P&gt;var city =&amp;nbsp;Calculate(SUM(F_city[Value]))&lt;/P&gt;&lt;P&gt;return Divide(state/city)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 06:35:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2766209#M85914</guid>
      <dc:creator>ngutc</dc:creator>
      <dc:date>2022-09-14T06:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide with a higher hierarchy group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2766600#M85945</link>
      <description>&lt;P&gt;I can think of a couple of options. You could link your states dimension table to the cities dimension, creating a snowflake schema. Or within your measure you could move the filters between dimensions using TREATAS. For example, within an iterator over cities you could do something like&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;var totalStateValue = CALCULATE( SUM(F_state[value]), TREATAS( VALUES(D_cities[state]), D_states[state]))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 14 Sep 2022 08:43:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2766600#M85945</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-09-14T08:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide with a higher hierarchy group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2766625#M85948</link>
      <description>&lt;P&gt;I can't make any changes in the model. That's why I'm trying to find out another way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont really understad the function TREATAS, how does it work in this situation. is the var totalStateValue my defined var state? Why this facts table if I'm trying to make change in the F_city table?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 08:50:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2766625#M85948</guid>
      <dc:creator>ngutc</dc:creator>
      <dc:date>2022-09-14T08:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide with a higher hierarchy group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2766731#M85956</link>
      <description>&lt;P&gt;TREATAS basically moves filters from one table to another. If you place a filter on the d_cities table for a specific city, e.g. in a table visual, that will also filter the values in the state column of d_cities table. You can then move that filter using TREATAS onto the d_states table, so any calculations you do on the F_state table will be filtered to just those rows related to the current state.&lt;/P&gt;
&lt;P&gt;SQLBI have a &lt;A href="https://www.youtube.com/watch?v=6WU7Ze32Q3w" target="_self"&gt;video on TREATAS&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 09:23:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2766731#M85956</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-09-14T09:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide with a higher hierarchy group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2766862#M85967</link>
      <description>&lt;P&gt;Could show on my example the use of this function?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 09:57:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2766862#M85967</guid>
      <dc:creator>ngutc</dc:creator>
      <dc:date>2022-09-14T09:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide with a higher hierarchy group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2766958#M85975</link>
      <description>&lt;P&gt;Put the below measure in a table visual with F_city[state] and Time[Year]&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;My Measure =
VAR cityValue =
    SUM ( F_city[Value] )
VAR stateValue =
    CALCULATE (
        SUM ( F_state[Value] ),
        TREATAS ( VALUES ( F_city[state] ), d_state[state] )
    )
RETURN
    DIVIDE ( stateValue, cityValue )
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 14 Sep 2022 10:35:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2766958#M85975</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-09-14T10:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide with a higher hierarchy group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2767257#M85998</link>
      <description>&lt;P&gt;In the line TREATAS -&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;( VALUES ( F_city[state] )&lt;/PRE&gt;&lt;P&gt;this value I don't have in my table (state column in not in the F_City table). How can it work¨,&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 12:30:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2767257#M85998</guid>
      <dc:creator>ngutc</dc:creator>
      <dc:date>2022-09-14T12:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide with a higher hierarchy group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2767297#M86001</link>
      <description>&lt;P&gt;use D_cities[state] instead&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 12:48:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2767297#M86001</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-09-14T12:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide with a higher hierarchy group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2777423#M86751</link>
      <description>&lt;P&gt;I don't think that's the solution I am looking for. Or it doesn't give me the results I want. mainly I dont understand why do I treat as the column state in D_cities and D-state column state? And should't the &lt;EM&gt;&lt;STRONG&gt;treatas&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;be in the filter of the first variable, the c&lt;EM&gt;ityValue?&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 11:01:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-divide-with-a-higher-hierarchy-group/m-p/2777423#M86751</guid>
      <dc:creator>ngutc</dc:creator>
      <dc:date>2022-09-19T11:01:54Z</dc:date>
    </item>
  </channel>
</rss>

