<?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: DAX Calculated Column to identify price deviation in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculated-Column-to-identify-price-deviation/m-p/2220999#M52738</link>
    <description>&lt;P&gt;The &lt;STRONG&gt;mode&lt;/STRONG&gt; is the most frequently occurring value and &lt;A href="https://www.daxpatterns.com/statistical-patterns/" target="_blank"&gt;DAX Patterns&lt;/A&gt; gives this general approach:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Mode :=
MINX (
    TOPN (
        1,
        ADDCOLUMNS (
            VALUES ( Data[Value] ),
            "Frequency", CALCULATE ( COUNT ( Data[Value] ) )
        ),
        [Frequency],
        0
    ),
    Data[Value]
)&lt;/LI-CODE&gt;
&lt;P&gt;This prior post gives further examples of how to apply this:&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Calculating-mode-of-a-measure/m-p/83116" target="_blank"&gt;https://community.powerbi.com/t5/Desktop/Calculating-mode-of-a-measure/m-p/83116&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you don't want the mode over the whole table (just the current product), you'll have to do a bit of additional filtering:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;PROMO / OVERPRICE :=
VAR CurrProduct = Sales[Product]
VAR FreqTable =
    GROUPBY (
        FILTER ( Sales, Sales[Product] = CurrProduct ),
        Sales[Retail Price],
        "Frequency", SUMX ( CURRENTGROUP (), 1 )
    )
VAR Mode =
    MINX ( TOPN ( 1, FreqTable, [Frequency] ), Sales[Retail Price] )
RETURN
    SWITCH (
        TRUE (),
        Sales[Retail Price] &amp;lt; Mode, "PROMO",
        Sales[Retail Price] &amp;gt; Mode, "OVERPRICE"
    )&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 04 Dec 2021 17:23:14 GMT</pubDate>
    <dc:creator>AlexisOlson</dc:creator>
    <dc:date>2021-12-04T17:23:14Z</dc:date>
    <item>
      <title>DAX Calculated Column to identify price deviation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculated-Column-to-identify-price-deviation/m-p/2220935#M52722</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help identifying price deviations in my sales table.&lt;/P&gt;&lt;P&gt;In fact I would like to find a way to determine if a sale has been the subject of a promotion or on the contrary if the sale price is higher than usual.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of what I would like to see:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Product&lt;/TD&gt;&lt;TD&gt;Retail Price&lt;/TD&gt;&lt;TD&gt;PROMO / OVERPRICE&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&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gt;I need this to be done in a calculated column to be able to use the "Promo / Overprice" column in a slicer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought about creating a formula that identifies the most redundant price for each product and comparing the sales prices against that price.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I have no idea of the syntax of my measurement to bring out the price that comes up most often by product.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone can help me ? Thanks in advance !!!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Pauline&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 14:26:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculated-Column-to-identify-price-deviation/m-p/2220935#M52722</guid>
      <dc:creator>DIACHROMA</dc:creator>
      <dc:date>2021-12-04T14:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Calculated Column to identify price deviation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculated-Column-to-identify-price-deviation/m-p/2220999#M52738</link>
      <description>&lt;P&gt;The &lt;STRONG&gt;mode&lt;/STRONG&gt; is the most frequently occurring value and &lt;A href="https://www.daxpatterns.com/statistical-patterns/" target="_blank"&gt;DAX Patterns&lt;/A&gt; gives this general approach:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Mode :=
MINX (
    TOPN (
        1,
        ADDCOLUMNS (
            VALUES ( Data[Value] ),
            "Frequency", CALCULATE ( COUNT ( Data[Value] ) )
        ),
        [Frequency],
        0
    ),
    Data[Value]
)&lt;/LI-CODE&gt;
&lt;P&gt;This prior post gives further examples of how to apply this:&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Calculating-mode-of-a-measure/m-p/83116" target="_blank"&gt;https://community.powerbi.com/t5/Desktop/Calculating-mode-of-a-measure/m-p/83116&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you don't want the mode over the whole table (just the current product), you'll have to do a bit of additional filtering:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;PROMO / OVERPRICE :=
VAR CurrProduct = Sales[Product]
VAR FreqTable =
    GROUPBY (
        FILTER ( Sales, Sales[Product] = CurrProduct ),
        Sales[Retail Price],
        "Frequency", SUMX ( CURRENTGROUP (), 1 )
    )
VAR Mode =
    MINX ( TOPN ( 1, FreqTable, [Frequency] ), Sales[Retail Price] )
RETURN
    SWITCH (
        TRUE (),
        Sales[Retail Price] &amp;lt; Mode, "PROMO",
        Sales[Retail Price] &amp;gt; Mode, "OVERPRICE"
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 04 Dec 2021 17:23:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculated-Column-to-identify-price-deviation/m-p/2220999#M52738</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-12-04T17:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Calculated Column to identify price deviation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculated-Column-to-identify-price-deviation/m-p/2224784#M52930</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="270902" data-lia-user-login="DIACHROMA" class="lia-mention lia-mention-user"&gt;DIACHROMA&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Did AlexisOlson&amp;nbsp;'s suggestions help with your scenario? if that is the case, you can consider Kudo or accept his suggestions to help others who faced similar requirements.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;If that also doesn't help, please share more detailed information to help us clarify your scenario to test.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="http://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&amp;nbsp;&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 08:36:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculated-Column-to-identify-price-deviation/m-p/2224784#M52930</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-07T08:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Calculated Column to identify price deviation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculated-Column-to-identify-price-deviation/m-p/2225603#M52981</link>
      <description>&lt;P&gt;Thank you very much&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;,&amp;nbsp;I just tested your formula and it works perfectly to meet my needs &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 14:28:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Calculated-Column-to-identify-price-deviation/m-p/2225603#M52981</guid>
      <dc:creator>DIACHROMA</dc:creator>
      <dc:date>2021-12-07T14:28:02Z</dc:date>
    </item>
  </channel>
</rss>

