<?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: Tabular Editor Format String Expression help in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-Format-String-Expression-help/m-p/2959379#M98461</link>
    <description>&lt;P&gt;Thank you for the reply,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;. I think I did a poor job of explaining my desired final result; I apologize. It's a matrix visual and accompanying measure slicer. The measure slicer displays the values in the unrelated Measure Dimensions table in my PBIX:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Measure Dimensions = {
    ("Accepted Sum",1),
    ("Ask Sum",2),
    ("Expected Sum",3),
    ("Accepted Count",4),
    ("Ask Count",5),
    ("Expected Count",6)
}&lt;/LI-CODE&gt;&lt;P&gt;Which contains, in turn, a measure called Measure Selection:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Measure Selection = 
IF(ISCROSSFILTERED('Measure Dimensions'[Dimension]),
SWITCH(TRUE(),
    VALUES('Measure Dimensions'[Dimension]) = "Accepted Sum",[Accepted Amount],
    VALUES('Measure Dimensions'[Dimension]) = "Expected Sum",[Expected Ask Amount],
    VALUES('Measure Dimensions'[Dimension]) = "Ask Sum",[Ask Amount],
    VALUES('Measure Dimensions'[Dimension]) = "Accepted Count",[Accepted Ask Count],
    VALUES('Measure Dimensions'[Dimension]) = "Expected Count",[Expected Ask Count],
    VALUES('Measure Dimensions'[Dimension]) = "Ask Count",[Asks Made Count],
    BLANK()
),BLANK()
)&lt;/LI-CODE&gt;&lt;P&gt;Each of the measures referenced there is from my main Measures table in my PBIX. I created a Time Intelligence calculation group with a couple calcuation items that I'd like to display in my matrix. When I select a measure in my slicer that's a count, I want the format to be&amp;nbsp;"#,0". When I select a measure that's a sum, I want the format to be "$#,#.00".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So when I make this selection, I expect to see whole numbers with a comma (where applicable):&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;When I make this selection, I'd like to see floats out to 2 digits and a dollar sign:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FWIW, the YoY% format is set via the Format String Expression in the YoY% calculation item in Tabular Editor:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I've tried setting the Format String Expression for the "Current" calculation item in Tabular Editor thusly:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;VAR DOLLARS = 
    SWITCH(
        TRUE(),
        SELECTEDMEASURENAME() = "Accepted Sum",1,
        SELECTEDMEASURENAME()  = "Ask Sum",1,
        0
    )
//VAR SumFormat = ( "$#,#.00") --excluded for testing
//VAR CountFormat = ( "(#,0)") --excluded for testing
RETURN 
    IF (DOLLARS,"$#,#.00","#,0")&lt;/LI-CODE&gt;&lt;P&gt;and this expression &lt;EM&gt;does&lt;/EM&gt; seem to be applying the comma (I made sure the settings for the measure in the PBIX are set to not display a comma), but it's not applying the $ sign.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was looking at &lt;A title="how to implement dynamic format strings" href="https://www.sqlbi.com/articles/dynamic-format-strings-with-calculation-groups/" target="_blank" rel="noopener"&gt;this&lt;/A&gt; yesterday afternoon and wonder if my resolution is that I need to create another calculation group in Tabular Editor to house my measures, then use those measures in my matrix. I've only read through that article 5 times now, so I'll need some time to read it five more times, which is the average number of times I need to read a SQLBI article before I understand it.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for taking the time to look at this issue.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Dec 2022 15:21:17 GMT</pubDate>
    <dc:creator>MarkPalmberg</dc:creator>
    <dc:date>2022-12-09T15:21:17Z</dc:date>
    <item>
      <title>Tabular Editor Format String Expression help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-Format-String-Expression-help/m-p/2957489#M98307</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to Tabular Editor and calculation groups, and I'm wondering if I might get some advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table containing a dimension that controls dynamic measure selection in my PBIX. It looks like this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;IF(ISCROSSFILTERED('Measure Dimensions'[Dimension]),
SWITCH(TRUE(),
    VALUES('Measure Dimensions'[Dimension]) = "Accepted Sum",[Accepted Amount],
    VALUES('Measure Dimensions'[Dimension]) = "Expected Sum",[Expected Ask Amount],
    VALUES('Measure Dimensions'[Dimension]) = "Ask Sum",[Ask Amount],
    VALUES('Measure Dimensions'[Dimension]) = "Accepted Count",[Accepted Ask Count],
    VALUES('Measure Dimensions'[Dimension]) = "Expected Count",[Expected Ask Count],
    VALUES('Measure Dimensions'[Dimension]) = "Ask Count",[Asks Made Count],
    BLANK()
),BLANK()
)&lt;/LI-CODE&gt;&lt;P&gt;I followed some &lt;A title="SQLBI" href="https://www.sqlbi.com/calculation-groups/" target="_self"&gt;online&lt;/A&gt; &lt;A title="MSFT" href="https://learn.microsoft.com/en-us/analysis-services/tabular-models/calculation-groups?view=asallproducts-allversions" target="_self"&gt;tutorials&lt;/A&gt; to build out a Time Intelligence calculation group in Tabular Editor (TE). One of my takeaways there was that &lt;EM&gt;the format set for the calculation items in TE overrides the format set on the measure in the PBIX&lt;/EM&gt;; this is fine given my current use case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where I'm at now is setting the format for the SELECTEDMEASURE() based on the name of the selected measure from my measure dimension table. So, if it's a count, the format should be (I think) "0,0;-0,0", and if it's a sum, it should be "$0.00;-$0.00".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I accomplish this via the Format String Expression in the Expression Editor in TE? If so, do I have to explicitly add the same DAX to the Format Expression for each of my calculation items?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any tips you can pass long!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 18:42:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-Format-String-Expression-help/m-p/2957489#M98307</guid>
      <dc:creator>MarkPalmberg</dc:creator>
      <dc:date>2022-12-08T18:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Tabular Editor Format String Expression help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-Format-String-Expression-help/m-p/2957673#M98323</link>
      <description>&lt;P&gt;So, I'm zeroing in(?). Here's what I've entered in the Format String Expression field for my "Current" Time Intelligence calculation item:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;VAR DOLLARS = 
    SWITCH(
        TRUE(),
        SELECTEDMEASURENAME() = "Accepted Sum",1,
        SELECTEDMEASURENAME()  = "Ask Sum",1,
        0
    )
VAR SumFormat = ( "$#,0.00" )
VAR CountFormat = ( "#,0")
RETURN 
    IF (DOLLARS,SumFormat,CountFormat)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;And here's what it now looks like in my matrix when I select one of my "sum" measures:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;So the comma is working, at least; dunno yet why the $ isn't displaying....&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 21:19:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-Format-String-Expression-help/m-p/2957673#M98323</guid>
      <dc:creator>MarkPalmberg</dc:creator>
      <dc:date>2022-12-08T21:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: Tabular Editor Format String Expression help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-Format-String-Expression-help/m-p/2957920#M98345</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="61102" data-lia-user-login="MarkPalmberg" class="lia-mention lia-mention-user"&gt;MarkPalmberg&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please have a try.&lt;/P&gt;
&lt;P&gt;My sample measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = IF(MAX('Table'[Column1])&amp;gt;20,FORMAT(MAX('Table'[Column1]),"$#,0.00"),FORMAT(MAX('Table'[Column1]),"#,0"))&lt;/LI-CODE&gt;
&lt;P&gt;You can change you measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VAR DOLLARS = 
    SWITCH(
        TRUE(),
        SELECTEDMEASURENAME() = "Accepted Sum",1,
        SELECTEDMEASURENAME()  = "Ask Sum",1,
        0
    )
VAR SumFormat = FORMAT(MAX('Table'[Column]),"$#,0.00")
VAR CountFormat = FORMAT(MAX('Table'[Column1]),"#,0")
RETURN 
    IF (DOLLARS,SumFormat,CountFormat)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Community Support Team _ Polly&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 02:02:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-Format-String-Expression-help/m-p/2957920#M98345</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-09T02:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Tabular Editor Format String Expression help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-Format-String-Expression-help/m-p/2959379#M98461</link>
      <description>&lt;P&gt;Thank you for the reply,&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;. I think I did a poor job of explaining my desired final result; I apologize. It's a matrix visual and accompanying measure slicer. The measure slicer displays the values in the unrelated Measure Dimensions table in my PBIX:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Measure Dimensions = {
    ("Accepted Sum",1),
    ("Ask Sum",2),
    ("Expected Sum",3),
    ("Accepted Count",4),
    ("Ask Count",5),
    ("Expected Count",6)
}&lt;/LI-CODE&gt;&lt;P&gt;Which contains, in turn, a measure called Measure Selection:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Measure Selection = 
IF(ISCROSSFILTERED('Measure Dimensions'[Dimension]),
SWITCH(TRUE(),
    VALUES('Measure Dimensions'[Dimension]) = "Accepted Sum",[Accepted Amount],
    VALUES('Measure Dimensions'[Dimension]) = "Expected Sum",[Expected Ask Amount],
    VALUES('Measure Dimensions'[Dimension]) = "Ask Sum",[Ask Amount],
    VALUES('Measure Dimensions'[Dimension]) = "Accepted Count",[Accepted Ask Count],
    VALUES('Measure Dimensions'[Dimension]) = "Expected Count",[Expected Ask Count],
    VALUES('Measure Dimensions'[Dimension]) = "Ask Count",[Asks Made Count],
    BLANK()
),BLANK()
)&lt;/LI-CODE&gt;&lt;P&gt;Each of the measures referenced there is from my main Measures table in my PBIX. I created a Time Intelligence calculation group with a couple calcuation items that I'd like to display in my matrix. When I select a measure in my slicer that's a count, I want the format to be&amp;nbsp;"#,0". When I select a measure that's a sum, I want the format to be "$#,#.00".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So when I make this selection, I expect to see whole numbers with a comma (where applicable):&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;When I make this selection, I'd like to see floats out to 2 digits and a dollar sign:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FWIW, the YoY% format is set via the Format String Expression in the YoY% calculation item in Tabular Editor:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I've tried setting the Format String Expression for the "Current" calculation item in Tabular Editor thusly:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;VAR DOLLARS = 
    SWITCH(
        TRUE(),
        SELECTEDMEASURENAME() = "Accepted Sum",1,
        SELECTEDMEASURENAME()  = "Ask Sum",1,
        0
    )
//VAR SumFormat = ( "$#,#.00") --excluded for testing
//VAR CountFormat = ( "(#,0)") --excluded for testing
RETURN 
    IF (DOLLARS,"$#,#.00","#,0")&lt;/LI-CODE&gt;&lt;P&gt;and this expression &lt;EM&gt;does&lt;/EM&gt; seem to be applying the comma (I made sure the settings for the measure in the PBIX are set to not display a comma), but it's not applying the $ sign.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was looking at &lt;A title="how to implement dynamic format strings" href="https://www.sqlbi.com/articles/dynamic-format-strings-with-calculation-groups/" target="_blank" rel="noopener"&gt;this&lt;/A&gt; yesterday afternoon and wonder if my resolution is that I need to create another calculation group in Tabular Editor to house my measures, then use those measures in my matrix. I've only read through that article 5 times now, so I'll need some time to read it five more times, which is the average number of times I need to read a SQLBI article before I understand it.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for taking the time to look at this issue.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 15:21:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-Format-String-Expression-help/m-p/2959379#M98461</guid>
      <dc:creator>MarkPalmberg</dc:creator>
      <dc:date>2022-12-09T15:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: Tabular Editor Format String Expression help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-Format-String-Expression-help/m-p/2959427#M98466</link>
      <description>&lt;P&gt;Well, the (a) solution appears to be to not use SELECTEDMEASURENAME() in the Format String Expression box but to use the SELECTEDVALUE() from my Measure Dimensions table. Like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;VAR DOLLARS = 
    SWITCH(
        TRUE(),
        SELECTEDVALUE('Measure Dimensions'[Dimension]) = "Accepted Sum",1,
        SELECTEDVALUE('Measure Dimensions'[Dimension]) = "Ask Sum",1,
        0
    )
VAR SumFormat = ( "$#,#.00")
VAR CountFormat = ( "(#,0)")
RETURN 
    IF (DOLLARS,SumFormat,CountFormat)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your time looking at this,&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;! I really appreciate it and am sorry to have wasted it!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt; &lt;A title="Quick tip on how to ensure your Format String Expression in the Power BI Calculation Group works" href="https://www.fourmoo.com/2020/11/04/quick-tip-on-how-to-ensure-your-format-string-expression-in-the-power-bi-calculation-group-works/" target="_blank" rel="noopener"&gt;Here's the post that finally got through my thick skull&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 18:08:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-Format-String-Expression-help/m-p/2959427#M98466</guid>
      <dc:creator>MarkPalmberg</dc:creator>
      <dc:date>2022-12-09T18:08:46Z</dc:date>
    </item>
  </channel>
</rss>

