<?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: Calculated Values in a Chart in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4121536#M163649</link>
    <description>&lt;P&gt;Unfortunately&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="785426" data-lia-user-login="ahadkarimi" class="lia-mention lia-mention-user"&gt;ahadkarimi&lt;/a&gt; what's happening with this is that PowerBI is not showing anything for the first measure you've suggested "Prior Service Count" and the second measure "Visit Count" is not returning a meaningful value. "Visit Count" is returning a number that is neither the total number of visits nor prior services and "Prior Service Count" is listing blank.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Aug 2024 22:15:10 GMT</pubDate>
    <dc:creator>SoupyNoodles14</dc:creator>
    <dc:date>2024-08-27T22:15:10Z</dc:date>
    <item>
      <title>Calculated Values in a Chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4117395#M163461</link>
      <description>&lt;P&gt;Below is a table that I built in SQL using a cross join for each customer visit-priorService, where we provide an "as of" list of prior services done for each customer visit to a store. At visit 1, customer A has only one prior high-level service done on 1/1/2006. At visit 2, that same customer has two prior services done, S1 high and S2 medium. Finally, at visit 3, that same customer has four prior services done, S1, S2, S3, and S4.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is possible for a customer to have no prior services done, as indicated by customer D. This table is only part of a star-schema where my dashboard is centered on visits, so an entry in this table NEEDS to be recorded for each visit in the table below to identify that that visit for customer D is associated with 0 prior services.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each prior service has a severity and date (as well as other fields not listed in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/05&lt;/TD&gt;&lt;TD&gt;Low&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;V7&lt;/TD&gt;&lt;TD&gt;9/1/21&lt;/TD&gt;&lt;TD&gt;S7&lt;/TD&gt;&lt;TD&gt;1/1/98&lt;/TD&gt;&lt;TD&gt;Medium&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;V7&lt;/TD&gt;&lt;TD&gt;9/1/21&lt;/TD&gt;&lt;TD&gt;S8&lt;/TD&gt;&lt;TD&gt;6/1/05&lt;/TD&gt;&lt;TD&gt;Low&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;V7&lt;/TD&gt;&lt;TD&gt;9/1/21&lt;/TD&gt;&lt;TD&gt;S9&lt;/TD&gt;&lt;TD&gt;1/1/21&lt;/TD&gt;&lt;TD&gt;High&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;V8&lt;/TD&gt;&lt;TD&gt;10/1/21&lt;/TD&gt;&lt;TD&gt;NULL&lt;/TD&gt;&lt;TD&gt;NULL&lt;/TD&gt;&lt;TD&gt;NULL&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The dashboard I've created has slicers on visit date, prior service date, and prior service severity.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I want to chart with the # of FILTERABLE prior services on the x-axis, and the number of visits on the y-axis.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;To achieve this, I initially built the following summary table separately in my data model.&lt;/P&gt;&lt;P&gt;Priors Counting Table = SUMMARIZE( 'Priors', Priors[VisitID], "PriorVisitCnt", DISTINCTCOUNTNOBLANK( 'Priors'[PriorServiceID] ) + 0 )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I linked this to my main visit-level table using the VisitID and got the chart I wanted, but the chart becomes meaningless when I filter on the service date or service type. Without any restrictions, there are upto 190 prior services done for a customer, but we need to see only the prior services done in 2017 when I filter on that service year for instance. It still shows 190 when I select 2017 on the slicer because there is a customer who had a grand total of 190 visits between 2000 (the oldest service recorded) and 2024 whose total amount of services keep showing. Based on my review of similar posts on this forum, it looks like measures can't be thrown into charts so easily but there COULD BE a workaround through calculated columns? I'm struggling a lot on this to even get the count of prior services per EACH visit on a measure to begin with. I already report on the min, max, median, and mean number of prior services done as of each visit for a customer, and it's very easy using a measure such as below. So I'm HOPEFUL something like this can be done at the chart-level?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Median =&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR Summary = SUMMARIZE('Priors', Priors[VisitID], "PriorVisitCnt", DISTINCTCOUNTNOBLANK( [PriorServiceID] ) + 0 )&lt;BR /&gt;RETURN MEDIANX ( Summary, [PowerBICnt] )&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2024 19:11:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4117395#M163461</guid>
      <dc:creator>SoupyNoodles14</dc:creator>
      <dc:date>2024-08-25T19:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated Values in a Chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4118977#M163528</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="796761" data-lia-user-login="SoupyNoodles14" class="lia-mention lia-mention-user"&gt;SoupyNoodles14&lt;/a&gt;,&amp;nbsp;try two measures below, and if you encounter any issues, let me know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Prior Service Count = 
VAR CurrentVisitID = SELECTEDVALUE('Priors'[VisitID])
RETURN
CALCULATE(
    COUNTROWS('Priors'),
    FILTER(
        'Priors',
        'Priors'[VisitID] = CurrentVisitID &amp;amp;&amp;amp; 
        NOT(ISBLANK('Priors'[PriorServiceID])) -- Exclude blanks (NULLs)
    )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Visit Count = 
CALCULATE(
    COUNTROWS('Priors'),
    ALLEXCEPT('Priors', 'Priors'[VisitID]) -- Ensures grouping by VisitID
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="center"&gt;&lt;FONT face="verdana,geneva"&gt;&lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;Did I answer your question?&amp;nbsp;&lt;/STRONG&gt; &lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;If so, please mark my post as the solution!&lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;FONT face="verdana,geneva"&gt;&lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;Your Kudos are much appreciated!&amp;nbsp;&lt;/STRONG&gt; &lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;Proud to be a Responsive Resident!&lt;/STRONG&gt;&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 15:48:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4118977#M163528</guid>
      <dc:creator>ahadkarimi</dc:creator>
      <dc:date>2024-08-26T15:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated Values in a Chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4120180#M163581</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="796761" data-lia-user-login="SoupyNoodles14" class="lia-mention lia-mention-user"&gt;SoupyNoodles14&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depend on your description,&amp;nbsp; maybe you can try formula like below to create measures:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Prior Service Count Per Visit = 
CALCULATE (
    DISTINCTCOUNT ( 'Priors'[PriorServiceID] ),
    ALLEXCEPT ( 'Priors', 'Priors'[VisitID] )
)
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Prior Services Count = 
CALCULATE (
    DISTINCTCOUNT ( 'Priors'[PriorServiceID] ),
    FILTER(Priors,[Measure] = 0)
)
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Visit Count = CALCULATE ( DISTINCTCOUNT ( 'Priors'[VisitID] ) )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Measure = IF(MAX(Priors[PriorServiceID]) = BLANK(),1,0)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 07:45:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4120180#M163581</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-27T07:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated Values in a Chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4121536#M163649</link>
      <description>&lt;P&gt;Unfortunately&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="785426" data-lia-user-login="ahadkarimi" class="lia-mention lia-mention-user"&gt;ahadkarimi&lt;/a&gt; what's happening with this is that PowerBI is not showing anything for the first measure you've suggested "Prior Service Count" and the second measure "Visit Count" is not returning a meaningful value. "Visit Count" is returning a number that is neither the total number of visits nor prior services and "Prior Service Count" is listing blank.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 22:15:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4121536#M163649</guid>
      <dc:creator>SoupyNoodles14</dc:creator>
      <dc:date>2024-08-27T22:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated Values in a Chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4123796#M163747</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="796761" data-lia-user-login="SoupyNoodles14" class="lia-mention lia-mention-user"&gt;SoupyNoodles14&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try the solution I provided, looking forward to your feedback.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Adamk Kong&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 01:42:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4123796#M163747</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-29T01:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated Values in a Chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4123823#M163750</link>
      <description>&lt;P&gt;Unfortunately it did not, but thank you for trying. FYI, when I initially posted this, it was flagged as spam incorrectly and so I re-posted the question here: &lt;A href="https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Dynamic-Measure-of-Distinct-Counts/m-p/4117855#M163477" target="_blank"&gt;https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-Dynamic-Measure-of-Distinct-Counts/m-p/4117855#M163477&lt;/A&gt;. The solution is working there. Someone at Microsoft un-flagged this original post.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 01:54:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Values-in-a-Chart/m-p/4123823#M163750</guid>
      <dc:creator>SoupyNoodles14</dc:creator>
      <dc:date>2024-08-29T01:54:21Z</dc:date>
    </item>
  </channel>
</rss>

