<?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 create a single measure that dynamically switches between showing a number or a percentage.. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-single-measure-that-dynamically-switches-between/m-p/4347625#M172665</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="904227" data-lia-user-login="BarbaraYanChen" class="lia-mention lia-mention-user"&gt;BarbaraYanChen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Create a Slicer Table&lt;/STRONG&gt;: Add a new table with options like "Show Value" and "Show Percentage":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SwitchTable = DATATABLE("Selection", STRING, {{"Show Value"}, {"Show Percentage"}})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Create a Dynamic Measure&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DynamicMeasure = 
SWITCH(
    SELECTEDVALUE(SwitchTable[Selection], "Show Value"),
    "Show Value", SUM('YourTable'[Value Only]),
    "Show Percentage", SUM('YourTable'[Pct Only])
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Add a Slicer:&lt;/STRONG&gt; Use SwitchTable[Selection] as a slicer on the report.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Use the Measure:&lt;/STRONG&gt; Add DynamicMeasure to your line chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution, this will help others!&lt;/STRONG&gt;&lt;BR /&gt;If my response(s) assisted you in any way, don't forget to drop me a "&lt;STRONG&gt;Kudos&lt;/STRONG&gt;" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Poojara&lt;BR /&gt;Data Analyst | MSBI Developer | Power BI Consultant&lt;BR /&gt;&lt;STRONG&gt;Consider Subscribing my YouTube for Beginners/Advance Concepts:&lt;/STRONG&gt;&amp;nbsp;&lt;A href="https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS" target="_self"&gt;https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jan 2025 07:20:21 GMT</pubDate>
    <dc:creator>Poojara_D12</dc:creator>
    <dc:date>2025-01-01T07:20:21Z</dc:date>
    <item>
      <title>How to create a single measure that dynamically switches between showing a number or a percentage..</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-single-measure-that-dynamically-switches-between/m-p/4347391#M172656</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am making a line chart to show MoM trending in Power BI.&amp;nbsp; I want to&amp;nbsp;create a single measure that dynamically switches between showing a number or a percentage on the slicer selection.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data see below screenshot: I have two columns in the dataset, one is "Value Only" with number type, and the other one is "Pct Only" with percentage type.&lt;/P&gt;&lt;P&gt;Goal see below screenshot: I want to create a measure that can swith between number and percentage types&lt;/P&gt;&lt;P&gt;FYI:&amp;nbsp; it can't be text type as the value will be used for calculation (sum) in aggreated level as a total.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&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;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Barbara&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2024 18:03:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-single-measure-that-dynamically-switches-between/m-p/4347391#M172656</guid>
      <dc:creator>BarbaraYanChen</dc:creator>
      <dc:date>2024-12-31T18:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a single measure that dynamically switches between showing a number or a percentage..</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-single-measure-that-dynamically-switches-between/m-p/4347438#M172659</link>
      <description>&lt;P&gt;You are trying to do too much.&amp;nbsp; Use separate columns.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2024 19:30:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-single-measure-that-dynamically-switches-between/m-p/4347438#M172659</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-31T19:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a single measure that dynamically switches between showing a number or a percentage..</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-single-measure-that-dynamically-switches-between/m-p/4347625#M172665</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="904227" data-lia-user-login="BarbaraYanChen" class="lia-mention lia-mention-user"&gt;BarbaraYanChen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Create a Slicer Table&lt;/STRONG&gt;: Add a new table with options like "Show Value" and "Show Percentage":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SwitchTable = DATATABLE("Selection", STRING, {{"Show Value"}, {"Show Percentage"}})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Create a Dynamic Measure&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DynamicMeasure = 
SWITCH(
    SELECTEDVALUE(SwitchTable[Selection], "Show Value"),
    "Show Value", SUM('YourTable'[Value Only]),
    "Show Percentage", SUM('YourTable'[Pct Only])
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Add a Slicer:&lt;/STRONG&gt; Use SwitchTable[Selection] as a slicer on the report.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Use the Measure:&lt;/STRONG&gt; Add DynamicMeasure to your line chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution, this will help others!&lt;/STRONG&gt;&lt;BR /&gt;If my response(s) assisted you in any way, don't forget to drop me a "&lt;STRONG&gt;Kudos&lt;/STRONG&gt;" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Poojara&lt;BR /&gt;Data Analyst | MSBI Developer | Power BI Consultant&lt;BR /&gt;&lt;STRONG&gt;Consider Subscribing my YouTube for Beginners/Advance Concepts:&lt;/STRONG&gt;&amp;nbsp;&lt;A href="https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS" target="_self"&gt;https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jan 2025 07:20:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-single-measure-that-dynamically-switches-between/m-p/4347625#M172665</guid>
      <dc:creator>Poojara_D12</dc:creator>
      <dc:date>2025-01-01T07:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a single measure that dynamically switches between showing a number or a percentage..</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-single-measure-that-dynamically-switches-between/m-p/4347664#M172669</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="904227" data-lia-user-login="BarbaraYanChen" class="lia-mention lia-mention-user"&gt;BarbaraYanChen&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Easiest way to create a separate disconneted table for slicer and create a combined measure for this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Combined Measure = 
IF(
    SELECTEDVALUE( SlicerTable[Sort] )= 1,
    [MomValue],
IF(
    SELECTEDVALUE( SlicerTable[Sort] ) = 2,
    [MomPct],[MomValue]
) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Percntage formatting use measure's Dynamic format option and use below measure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IF(
    SELECTEDVALUE( SlicerTable[Sort] )= 1,
    "#,##0",
IF(
    SELECTEDVALUE( SlicerTable[Sort] ) =2,
    "0%","#,##0"
) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below screenshot&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;But, if you want to dare to see your screenshot result then create calculated table and use below code ( ideal way to create this table in Power query by simply unpivoting).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sctsht = 
VAR _1 = 
  SUMMARIZE( 'Table','Table'[Month] )
 VAR _2 = 
 UNION(
  ADDCOLUMNS(
	_1,"Value and Pct",[MomValue],
	"Tag","MomValue","Sort",1,"MonthSort",IF( 'Table'[Month] = "JAN",1, IF( 'Table'[Month] = "FEB",2 ) )
  ),
  ADDCOLUMNS(
	_1,"Value and Pct",[MomPct],"Tag","MomPct","Sort",2,"MonthSort",IF( 'Table'[Month] = "JAN",1, IF( 'Table'[Month] = "FEB",2 ) )
  ) )
  
RETURN
_2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For fomatting use same code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IF(
    SELECTEDVALUE( Sctsht[Tag] )= "MomValue",
    "#,##0",
IF(
    SELECTEDVALUE( Sctsht[Tag] ) ="MomPct",
    "0%","#,##0"
) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below screenshot&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Attached is the pbix file&lt;/P&gt;&lt;P&gt;&lt;A href="https://we.tl/t-pCBQoFQDhz" target="_blank"&gt;https://we.tl/t-pCBQoFQDhz&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope, it will help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;sanalytics&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jan 2025 09:49:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-single-measure-that-dynamically-switches-between/m-p/4347664#M172669</guid>
      <dc:creator>sanalytics</dc:creator>
      <dc:date>2025-01-01T09:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a single measure that dynamically switches between showing a number or a percentage..</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-single-measure-that-dynamically-switches-between/m-p/4348670#M172720</link>
      <description>&lt;P&gt;Create separate measures, one to show the value and one to show the %, and set the appropriate format strings. Create a field parameter, add those 2 measures to it and add a slicer to the page. Use the field parameter in your visual instead of the individual measures and the user will be able to switch which is displayed by using the slicer.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 16:25:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-single-measure-that-dynamically-switches-between/m-p/4348670#M172720</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2025-01-02T16:25:39Z</dc:date>
    </item>
  </channel>
</rss>

