<?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: Dynamic calculation in text statements in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Dynamic-calculation-in-text-statements/m-p/1090079#M23688</link>
    <description>&lt;P&gt;@Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use &lt;STRONG&gt;selectedvalue()&lt;/STRONG&gt; to get the brand or area.&amp;nbsp;&lt;A href="https://www.sqlbi.com/articles/using-the-selectedvalue-function-in-dax/" target="_blank"&gt;https://www.sqlbi.com/articles/using-the-selectedvalue-function-in-dax/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;message =
VAR _brand =
    CALCULATE (
        SELECTEDVALUE ( 'Table'[brand] )
    )
VAR _sales = [Sales] //sales measure
VAR _area =
    CALCULATE (
        SELECTEDVALUE ( 'Table'[area] )
    )
VAR _message = _brand &amp;amp; " sale " &amp;amp; _sales &amp;amp; " Percent from " &amp;amp; _area
RETURN
    _message&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution!&lt;BR /&gt;Appreciate with a kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 May 2020 16:11:24 GMT</pubDate>
    <dc:creator>nandukrishnavs</dc:creator>
    <dc:date>2020-05-14T16:11:24Z</dc:date>
    <item>
      <title>Dynamic calculation in text statements</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Dynamic-calculation-in-text-statements/m-p/1089876#M23687</link>
      <description>&lt;P&gt;&lt;SPAN&gt;HelHi All,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can you please help me on one more thing&amp;nbsp;I am looking for something like below&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;a brand sale 98 Percent&amp;nbsp; from Asia&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;b brand&amp;nbsp;sales 80 percent from Europe&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here each text statement has a calculated value like 98 and 80 which are dynamic when we select filters. This we have achieved in tableau. can we achieve this in Power BI&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please let me&amp;nbsp;know.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks &amp;amp; Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Kumar.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 14:18:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Dynamic-calculation-in-text-statements/m-p/1089876#M23687</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-14T14:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic calculation in text statements</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Dynamic-calculation-in-text-statements/m-p/1090079#M23688</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use &lt;STRONG&gt;selectedvalue()&lt;/STRONG&gt; to get the brand or area.&amp;nbsp;&lt;A href="https://www.sqlbi.com/articles/using-the-selectedvalue-function-in-dax/" target="_blank"&gt;https://www.sqlbi.com/articles/using-the-selectedvalue-function-in-dax/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;message =
VAR _brand =
    CALCULATE (
        SELECTEDVALUE ( 'Table'[brand] )
    )
VAR _sales = [Sales] //sales measure
VAR _area =
    CALCULATE (
        SELECTEDVALUE ( 'Table'[area] )
    )
VAR _message = _brand &amp;amp; " sale " &amp;amp; _sales &amp;amp; " Percent from " &amp;amp; _area
RETURN
    _message&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution!&lt;BR /&gt;Appreciate with a kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 16:11:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Dynamic-calculation-in-text-statements/m-p/1090079#M23688</guid>
      <dc:creator>nandukrishnavs</dc:creator>
      <dc:date>2020-05-14T16:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic calculation in text statements</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Dynamic-calculation-in-text-statements/m-p/1097421#M23770</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;I think you need to do some transform in query editor side to create calculation columns to extract specific value form your text statement, then you can simply calculate on these new columns.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlRIKkrMS1EoTsxJVbC0UAhILUpOzStRUEgrys9VcCzOTFSK1YlWSkJSVqxgYaBQAFUHVuZaWpRfkKqgFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Test = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Test", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Merged", each Text.Combine(List.ReplaceMatchingItems(Text.Split ([Test], " "),{{"brand", ""},{"Percent", ""},{"percent", "" },{"sale", ","},{"sales", ","},{"from", "," }}))),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Added Custom", "Merged", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Brand", "Percent", "Region"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Brand", type text}, {"Percent", Int64.Type}, {"Region", type text}})
in
    #"Changed Type1"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="14.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/276701i16508BA9B3206F0A/image-size/large?v=v2&amp;amp;px=999" role="button" title="14.png" alt="14.png" /&gt;&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Reference link:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Power-Query-Replace-multiple-substrings-in-one-column/td-p/409573" target="_self"&gt;Power Query - Replace multiple substrings in one column&lt;/A&gt;&amp;nbsp;&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>Wed, 20 May 2020 06:57:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Dynamic-calculation-in-text-statements/m-p/1097421#M23770</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-20T06:57:02Z</dc:date>
    </item>
  </channel>
</rss>

