<?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 Error: “Text with Number Comparison” When Filtering with Disconnected Slicer Using TREATAS in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Error-Text-with-Number-Comparison-When-Filtering-with/m-p/4708341#M180329</link>
    <description>&lt;P&gt;Hi Pete, thanks for your input earlier!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I wanted to share that the issue has been resolved. The main challenge was caused by performance bottlenecks due to complex logic using SUMMARIZE + FILTER and row-level calculations in DAX. These were especially problematic when applying slicers across multiple related tables (e.g. sector, portfolio, client).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I resolved it by:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Precomputing avg_emissions_per_revenue_mil in &lt;STRONG&gt;Power Query&lt;/STRONG&gt;, and&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Rewriting the DAX using FILTER + DISTINCTCOUNT on the cleaned dataset instead of SUMMARIZE.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;I also handled the &lt;STRONG&gt;scope&lt;/STRONG&gt; and &lt;STRONG&gt;multi-select source&lt;/STRONG&gt; logic directly inside the measure, using CONTAINS on VALUES(SourceSelector[Source]).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This dramatically improved performance and allowed scope/source slicers and client-linked filters to work smoothly together.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help — I appreciate the engagement!&lt;/P&gt;</description>
    <pubDate>Tue, 27 May 2025 06:30:49 GMT</pubDate>
    <dc:creator>user_guddu10</dc:creator>
    <dc:date>2025-05-27T06:30:49Z</dc:date>
    <item>
      <title>DAX Error: “Text with Number Comparison” When Filtering with Disconnected Slicer Using TREATAS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Error-Text-with-Number-Comparison-When-Filtering-with/m-p/4708100#M180318</link>
      <description>&lt;P&gt;Hi community,&lt;/P&gt;&lt;P&gt;I'm working on a Benchmark_Asset_Count_Rev measure that should dynamically filter a benchmark dataset (benchmarking_cleaned_combined) based on selections from two disconnected slicers:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;SourceSelector[Source]&lt;/STRONG&gt; — a text slicer with values like "Private Markets" and "Listed"&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;ScopeSelector[ScopeName]&lt;/STRONG&gt; — a multi-select slicer for Scope 1, Scope 2, and Scope 3&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;H3&gt;&lt;STRONG&gt;Background&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;The dataset (benchmarking_cleaned_combined) contains rows of company emissions and revenue data. From that table, I created the following calculated columns in &lt;STRONG&gt;Power Query&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;scope1_per_revenue = [scope1] / ([revenue_usd] / 1000000)&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;scope2_per_revenue = [scope2] / ([revenue_usd] / 1000000)&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;scope3_per_revenue = [scope3] / ([revenue_usd] / 1000000)&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;avg_emissions_per_revenue_mil = average of the 3, excluding nulls&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;These are used to calculate emissions intensity by scope.&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;STRONG&gt;Goal:&lt;/STRONG&gt;&lt;BR /&gt;Filter benchmarking_cleaned_combined using:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;TREATAS to apply the selected &lt;STRONG&gt;Source&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Dynamic SWITCH(TRUE(), ...) to apply &lt;STRONG&gt;Scope-based emissions per revenue thresholds&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;HR /&gt;&lt;P&gt;&lt;STRONG&gt;Problem:&lt;/STRONG&gt;&lt;BR /&gt;I keep getting this error:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;STRONG&gt;"DAX comparison operations do not support comparing values of type Text with values of type Number."&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Even though both:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;benchmarking_cleaned_combined[Source] is a &lt;STRONG&gt;Text&lt;/STRONG&gt; column&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;SourceSelector[Source] is also a &lt;STRONG&gt;Text&lt;/STRONG&gt; column defined as a DATATABLE&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;Also scope columns and revenue columns are also decimal numbers&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DAX Measure:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Benchmark_Asset_Count_Rev =
VAR _SelectedScopes = VALUES(ScopeSelector[ScopeName])
VAR _IncludeScope1 = CONTAINS(_SelectedScopes, ScopeSelector[ScopeName], "Scope 1")
VAR _IncludeScope2 = CONTAINS(_SelectedScopes, ScopeSelector[ScopeName], "Scope 2")
VAR _IncludeScope3 = CONTAINS(_SelectedScopes, ScopeSelector[ScopeName], "Scope 3")

VAR _SelectedSource =
    SELECTCOLUMNS(
        VALUES(SourceSelector),
        "Source", SourceSelector[Source]
    )

RETURN
CALCULATE(
    DISTINCTCOUNT(benchmarking_cleaned_combined[company_name]),

    // Match disconnected source selector
    TREATAS(_SelectedSource, benchmarking_cleaned_combined[Source]),

    // Apply emissions filtering logic
    SWITCH(
        TRUE(),
        NOT _IncludeScope1 &amp;amp;&amp;amp; NOT _IncludeScope2 &amp;amp;&amp;amp; NOT _IncludeScope3, FALSE(),

        _IncludeScope1 &amp;amp;&amp;amp; NOT _IncludeScope2 &amp;amp;&amp;amp; NOT _IncludeScope3,
            benchmarking_cleaned_combined[scope1_per_revenue] &amp;gt; 0.1,

        NOT _IncludeScope1 &amp;amp;&amp;amp; _IncludeScope2 &amp;amp;&amp;amp; NOT _IncludeScope3,
            benchmarking_cleaned_combined[scope2_per_revenue] &amp;gt; 0.1,

        NOT _IncludeScope1 &amp;amp;&amp;amp; NOT _IncludeScope2 &amp;amp;&amp;amp; _IncludeScope3,
            benchmarking_cleaned_combined[scope3_per_revenue] &amp;gt; 0.1,

        benchmarking_cleaned_combined[avg_emissions_per_revenue_mil] &amp;gt; 0.1
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Mock Data (benchmarking_cleaned_combined):&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;company_name report_year Source scope1 scope2 scope3 revenue_usd scope1_per_revenue scope2_per_revenue scope3_per_revenue avg_emissions_per_revenue_mil&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;2023&lt;/TD&gt;&lt;TD&gt;Private Markets&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;TD&gt;600&lt;/TD&gt;&lt;TD&gt;10000000&lt;/TD&gt;&lt;TD&gt;10.00&lt;/TD&gt;&lt;TD&gt;15.00&lt;/TD&gt;&lt;TD&gt;60.00&lt;/TD&gt;&lt;TD&gt;28.33&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;2023&lt;/TD&gt;&lt;TD&gt;Listed&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;50000000&lt;/TD&gt;&lt;TD&gt;0.00&lt;/TD&gt;&lt;TD&gt;0.00&lt;/TD&gt;&lt;TD&gt;1.00&lt;/TD&gt;&lt;TD&gt;1.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;2022&lt;/TD&gt;&lt;TD&gt;Private Markets&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;TD&gt;null&lt;/TD&gt;&lt;TD&gt;null&lt;/TD&gt;&lt;TD&gt;100000000&lt;/TD&gt;&lt;TD&gt;2.50&lt;/TD&gt;&lt;TD&gt;null&lt;/TD&gt;&lt;TD&gt;null&lt;/TD&gt;&lt;TD&gt;2.50&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I've tried:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Ensured both SourceSelector[Source] and [Source] in the main table are set to Text&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Replaced IN with TREATAS&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Used SELECTCOLUMNS to force a single-column table into TREATAS&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Verified the slicer is not referencing any legacy column&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Tried different ways to structure the logic (with FILTER, without SWITCH, etc.)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;HR /&gt;&lt;P&gt;Would appreciate any help understanding why this comparison error keeps happening despite both columns being Text — and how best to combine TREATAS with scope logic inside CALCULATE.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2025 02:59:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Error-Text-with-Number-Comparison-When-Filtering-with/m-p/4708100#M180318</guid>
      <dc:creator>user_guddu10</dc:creator>
      <dc:date>2025-05-27T02:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Error: “Text with Number Comparison” When Filtering with Disconnected Slicer Using TREATAS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Error-Text-with-Number-Comparison-When-Filtering-with/m-p/4708324#M180328</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="910248" data-lia-user-login="user_guddu10" class="lia-mention lia-mention-user"&gt;user_guddu10&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Firstly: I've given a thumbs-up for the effort you've spent laying out the background and problem so comprehensively, thank you. However, I still don't think there's enough information to 'properly' fix the issue.&lt;/P&gt;
&lt;P&gt;In my experience, when you're getting into using TREATAS and complicated switching measures&amp;nbsp;99% of the time it's a modelling issue. Unfortunately this isn't likely something I'll be able to fully diagnose/resolve without significantly more information and a lot of time.&lt;/P&gt;
&lt;P&gt;However, I would suggest the following based on what I can see:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Addressing the immediate issue: Make sure your column data types are set &lt;STRONG&gt;in Power Query&lt;/STRONG&gt; as Text type, not just in the data model. Also check the relevant columns in Power Query for Error values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Addressing the wider issue: I would recommend unpivoting your Scope1/2/3 columns in Power Query so the different scope values become attribute values in a single column. Remove the calculation of ScopeX_per_revenue from Power Query and do these calcs in your data model.&lt;/P&gt;
&lt;P&gt;I think you'll find your whole measure/calculation experience a whole lot simpler and smoother when you can leverage implicit scope selections directly on the table (or via a relationship if you want to keep the ScopeSelector table related to the fact table).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry I can't be of more immediate help, but I feel we're in &lt;A href="https://xyproblem.info/" target="_blank" rel="noopener"&gt;XY Problem&lt;/A&gt; territory on this one with the actual issue being resolved via a model rebuild to some degree.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pete&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2025 06:21:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Error-Text-with-Number-Comparison-When-Filtering-with/m-p/4708324#M180328</guid>
      <dc:creator>BA_Pete</dc:creator>
      <dc:date>2025-05-27T06:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Error: “Text with Number Comparison” When Filtering with Disconnected Slicer Using TREATAS</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Error-Text-with-Number-Comparison-When-Filtering-with/m-p/4708341#M180329</link>
      <description>&lt;P&gt;Hi Pete, thanks for your input earlier!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I wanted to share that the issue has been resolved. The main challenge was caused by performance bottlenecks due to complex logic using SUMMARIZE + FILTER and row-level calculations in DAX. These were especially problematic when applying slicers across multiple related tables (e.g. sector, portfolio, client).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I resolved it by:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Precomputing avg_emissions_per_revenue_mil in &lt;STRONG&gt;Power Query&lt;/STRONG&gt;, and&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Rewriting the DAX using FILTER + DISTINCTCOUNT on the cleaned dataset instead of SUMMARIZE.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;I also handled the &lt;STRONG&gt;scope&lt;/STRONG&gt; and &lt;STRONG&gt;multi-select source&lt;/STRONG&gt; logic directly inside the measure, using CONTAINS on VALUES(SourceSelector[Source]).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This dramatically improved performance and allowed scope/source slicers and client-linked filters to work smoothly together.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help — I appreciate the engagement!&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2025 06:30:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Error-Text-with-Number-Comparison-When-Filtering-with/m-p/4708341#M180329</guid>
      <dc:creator>user_guddu10</dc:creator>
      <dc:date>2025-05-27T06:30:49Z</dc:date>
    </item>
  </channel>
</rss>

