<?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: Need to create a measure - find the maximum identifier MAX ([ID] OVER [CASE_ID]) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/740892#M2251</link>
    <description>&lt;P&gt;Hi there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no such thing like:&lt;/P&gt;&lt;PRE&gt;measure C = Distinctcount[Measure A] / Distinctcount[Measure B]&lt;/PRE&gt;&lt;P&gt;DISTINCTCOUNT is a function that works on columns, not measures -&amp;gt;&amp;nbsp;&lt;A href="https://dax.guide/distinctcount/" target="_self"&gt;DISTINCTCOUNT documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll give you a hint if you want your question answered. &lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_self"&gt;Here&lt;/A&gt; it is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jul 2019 09:04:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-07-16T09:04:09Z</dc:date>
    <item>
      <title>Need to create a measure - find the maximum identifier MAX ([ID] OVER [CASE_ID])</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/739946#M2220</link>
      <description>&lt;P&gt;HI, I have a table F_JOB_STATUS:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;my task:&lt;BR /&gt;&lt;STRONG&gt;A/B*100&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;A&lt;/STRONG&gt; =&amp;nbsp;cases&amp;nbsp;&lt;EM&gt;([case_id])&lt;/EM&gt;&amp;nbsp;&lt;EM&gt;(only&amp;nbsp;[case_type_id] = 1 || 2)&amp;nbsp;solved ([case_status_id] = 7 &amp;amp;&amp;amp; [DE_ID] &amp;lt;&amp;gt; BLANK())&lt;/EM&gt; in shorter period &lt;EM&gt;([WTF] = 1)&lt;/EM&gt; during that month&lt;BR /&gt;&lt;STRONG&gt;B&lt;/STRONG&gt; = All solved cases&amp;nbsp;&lt;EM&gt;([case_status_id] = 7 &amp;amp;&amp;amp;, [DE_ID] &amp;lt;&amp;gt; BLANK())&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;As you can see, the id in the table is duplicated, you need to take into account the unique ones (for this, I think, need to find the id, like so: &lt;EM&gt;MAX([ID] over [CASE_ID])&lt;/EM&gt;)&lt;/P&gt;&lt;P&gt;To find the maximum id, I created a column&lt;/P&gt;&lt;PRE&gt;OPEN_C&amp;amp;C_WTF_MAX (F_JOB_Status) = 
CALCULATE(MAX(F_JOB_STATUS[ID]),FILTER(F_JOB_STATUS,F_JOB_STATUS[CASE_ID]=EARLIER(F_JOB_STATUS[CASE_ID])))&lt;/PRE&gt;&lt;P&gt;but it did not help me, since it is a column and when filtering by date it loses its meaning&lt;/P&gt;&lt;P&gt;Is it possible to create 2 measures A and B, in which conditions A and B are taken into account and the maximum id is taken into account?&lt;BR /&gt;or maybe there is another way?&lt;/P&gt;&lt;P&gt;&lt;A href="https://1drv.ms/u/s!AqK1YytALOG-3WcdRxfpT9cIRfMB?e=wkncOb" target="_self"&gt;MY pbix file&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help me&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 06:01:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/739946#M2220</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-16T06:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create a measure - find the maximum identifier MAX ([ID] OVER [CASE_ID])</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/740308#M2234</link>
      <description>&lt;P&gt;Mate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You want measures... That's OK but what are you going to slice the data by? Do you understand what the difference is between a measure and a calculated column?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, you say you want to filter by date... Do you have a Date table in your model connected to your fact table? If a single date is visible, then I could probably write the measures you want. But what if you select a whole month, like 2019-Jun? What should the measures return? Please, remember that when you create measures they should work correctly for any slicing of your dimensions. Please, kindly tell me if you really want a measure or a calculated column... It's not really clear what you want at this point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll have a look at the file as well but it would be good if you could clarify things.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 19:46:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/740308#M2234</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-15T19:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create a measure - find the maximum identifier MAX ([ID] OVER [CASE_ID])</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/740326#M2236</link>
      <description>&lt;P&gt;It looks like the values for the A and B measures in your table DO NOT correspond to the description of how to get them... unless I don't understand. But the very fact that I don't understand how you arrive at the numbers after reading the description several times means that you should post something that is human-readable and as clear as the day instead of forcing others to spend hours to understand "what you meant." If you do that, please do not expect any answers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please try to be precise when you describe a problem. Mathematics should have taught you that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 19:56:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/740326#M2236</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-15T19:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create a measure - find the maximum identifier MAX ([ID] OVER [CASE_ID])</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/740654#M2250</link>
      <description>&lt;P&gt;Good day,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;I still could not solve the problem. I need exactly the measure, because the measure will determine the maximum identifier after filtering by date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;And after that, I'm going to Create another measure:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;measure C = Distinctcount[Measure A] / Distinctcount[Measure B]&lt;/PRE&gt;&lt;P&gt;With this, I will solve the problem.&lt;/P&gt;&lt;P&gt;And, yes, I understand the difference between the measure and the column.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I am new to BI reporting.&lt;/STRONG&gt; At first I created a column and, after examining the result, I realized that I needed a measure.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 05:39:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/740654#M2250</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-16T05:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create a measure - find the maximum identifier MAX ([ID] OVER [CASE_ID])</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/740892#M2251</link>
      <description>&lt;P&gt;Hi there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no such thing like:&lt;/P&gt;&lt;PRE&gt;measure C = Distinctcount[Measure A] / Distinctcount[Measure B]&lt;/PRE&gt;&lt;P&gt;DISTINCTCOUNT is a function that works on columns, not measures -&amp;gt;&amp;nbsp;&lt;A href="https://dax.guide/distinctcount/" target="_self"&gt;DISTINCTCOUNT documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll give you a hint if you want your question answered. &lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_self"&gt;Here&lt;/A&gt; it is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 09:04:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/740892#M2251</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-16T09:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create a measure - find the maximum identifier MAX ([ID] OVER [CASE_ID])</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/741191#M2266</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I apologize, do not judge strictly, I am new to this forum and to POWER BI. And yet, I have a bad English, so I use a online translator.&lt;BR /&gt;Rewrote my post below, please see.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a call accounting table (&lt;A href="https://1drv.ms/x/s!AqK1YytALOG-3Wme3UB5wuFhsEQ2?e=j3a6Ze" target="_self"&gt;Demo data1&lt;/A&gt;). There are indicated:&lt;BR /&gt;1. ID&lt;BR /&gt;2. Treatment ID - [CASE_ID]&lt;BR /&gt;3. Type of treatment - [CASE_TYPE_ID]&lt;BR /&gt;4. Appeal status - [CASE_STATUS_ID]&lt;BR /&gt;5. Within Time Frame - [WTF]&lt;BR /&gt;6. id result - [DE_ID]&lt;BR /&gt;7. date of appeal status - [DATE]&lt;BR /&gt;8. institution ID - [I_ID]&lt;/P&gt;&lt;P&gt;my task:&lt;BR /&gt;&lt;STRONG&gt;A/B*100&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;A =&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;cases&amp;nbsp;&lt;/STRONG&gt;(&lt;EM&gt;[case_id]&lt;/EM&gt;)&amp;nbsp;(only&amp;nbsp;&lt;EM&gt;[case_type_id] = 1 || 2&lt;/EM&gt;)&amp;nbsp;&lt;STRONG&gt;solved&lt;/STRONG&gt; (&lt;EM&gt;[case_status_id] = 7 &amp;amp;&amp;amp; [DE_ID] &amp;lt;&amp;gt; BLANK()&lt;/EM&gt;) &lt;STRONG&gt;in shorter period&lt;/STRONG&gt; (&lt;EM&gt;[WTF] = 1&lt;/EM&gt;) &lt;STRONG&gt;during that month&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;B = All solved cases&lt;/STRONG&gt;&amp;nbsp;(&lt;EM&gt;[case_status_id] = 7 &amp;amp;&amp;amp;, [DE_ID] &amp;lt;&amp;gt; BLANK()&lt;/EM&gt;)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have to create a histogram, where [I_ID] axis, and values A * B / 100&lt;BR /&gt;filters will be by date (still by main authorities and for whose personnel I have not added to the test table)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’m having trouble “thinking in DAX”.&lt;/P&gt;&lt;P&gt;I ask for help.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 14:14:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/741191#M2266</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-16T14:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create a measure - find the maximum identifier MAX ([ID] OVER [CASE_ID])</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/741742#M2302</link>
      <description>&lt;P&gt;OK, first of all, you should create all the dimensions that will be joined to the fact table. When this is properly done, then you can write this:&lt;/P&gt;&lt;PRE&gt;-- The fact table should have dimensions connected to it
-- and slicing should be by the dims, not by the columns
-- in the fact table. The measures below overwrite
-- filters that would be put on the fields used in the
-- boolean conditions. If you want to keep existing filters
-- you have to add KEEPFILTERS to some/all the lines.

[A] =
calculate(
	-- I don't think you really wanted the maximum case_id.
	-- To me it does not make any sense. Counting the
	-- distinct case_id's, on the other hand, does make
	-- sense.
	distinctcount( FT[case_id] ), 
	'Treatment Type'[case_type_id] in {1,2},
	'Appeal Status'[case_status_id] = 7,
	'Result'[de_id] &amp;lt;&amp;gt; BLANK(),
	'Within Time Frame'[WTF] = 1
)

[B] =
calculate(	
	distinctcount( FT[case_id] ),
	'Appeal Status'[case_status_id] = 7,
	'Result'[de_id] &amp;lt;&amp;gt; BLANK()
)

-- You should not multiply this by 100. You should
-- change the formatting of this measure in Power BI.
-- This is the right way to do it.

[Final Measure] =
divide( [A], [B] ) 

-- If you want to KEEP existing filters on some of
-- the columns, you should write something similar
-- to this:

[A] =
calculate(
	distinctcount( FT[case_id] ),
	keepfilters( 'Treatment Type'[case_type_id] in {1,2} ),
	keepfilters( 'Appeal Status'[case_status_id] = 7),
	'Result'[de_id] &amp;lt;&amp;gt; BLANK(),
	'Within Time Frame'[WTF] = 1
)

-- If any filters exist on 'Treatment Type'[case_type_id]
-- then keepfilters( 'Treatment Type'[case_type_id] in {1,2} )
-- makes sure that the filters are not removed but intersected
-- with the condition 'Treatment Type'[case_type_id] in {1,2}.

-- Since you've not given me enough information on how this
-- should really work, this is the best I can do. If this
-- does not work the way you wanted, you have to always ensure
-- that you give as much info as possible.&lt;/PRE&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 04:47:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/741742#M2302</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-17T04:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create a measure - find the maximum identifier MAX ([ID] OVER [CASE_ID])</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/741799#M2304</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much. At first glance, everything works correctly. I will carefully check and if I have questions, I will write.&lt;BR /&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 06:22:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-create-a-measure-find-the-maximum-identifier-MAX-ID-OVER/m-p/741799#M2304</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-17T06:22:58Z</dc:date>
    </item>
  </channel>
</rss>

