<?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: Import Models and limitations on casting values in new columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4418560#M175447</link>
    <description>&lt;P&gt;Glad to hear it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;I was just looking at this and managed to reproduce the issue.&lt;/P&gt;
&lt;P&gt;From the error message, you have a DirectQuery connect to an existing Power BI semantic model and are adding a calculated column in the local model?&lt;/P&gt;
&lt;P&gt;There must have been a column containing "Closed" and ending in "irection" (among the other issues you've found I'm sure) &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, 20 Feb 2025 01:35:06 GMT</pubDate>
    <dc:creator>OwenAuger</dc:creator>
    <dc:date>2025-02-20T01:35:06Z</dc:date>
    <item>
      <title>Import Models and limitations on casting values in new columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4416524#M175375</link>
      <description>&lt;P&gt;I have an imported Semantic model and I was attempting to add a column to a table that involves extracting a text representation of a data and recasting as an actual date column. However every approach I tried resulted in an error that basically indicates the text values are not being recast as numerical values so can't be converted. However, when I convert the same code to a measure it works fine. The drawback of course as a measure is that I have to use MAX or MIN to 'aggregate' the values per row, and it means I'll have to set-up some scope handling for conditions where the column happens to be truly aggregagetted (the most likely 'risk' is matrices in this particular case).&lt;BR /&gt;&lt;BR /&gt;Is it correct to assunem this is a limitation of the Import Model process?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 21:44:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4416524#M175375</guid>
      <dc:creator>rpiboy_1</dc:creator>
      <dc:date>2025-02-18T21:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Import Models and limitations on casting values in new columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4416644#M175378</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="452756" data-lia-user-login="rpiboy_1" class="lia-mention lia-mention-user"&gt;rpiboy_1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you share some more detail on the text representations that you want to convert to date, and where in the process you are attempting the conversion?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are handling the conversion in Power Query, the &lt;FONT face="courier new,courier"&gt;Date.FromText&lt;/FONT&gt; function may be useful.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date.FromText("30 Dez 2010", [Format="dd MMM yyyy", Culture="de-DE"])

Date.FromText("10-Jan-2025", [Format="d-MMM-yyyy])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also handle conversions in a DAX calculated column but Power Query would be preferable.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 00:54:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4416644#M175378</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2025-02-19T00:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Import Models and limitations on casting values in new columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4416835#M175388</link>
      <description>&lt;P&gt;That is the thing, it's an imported published model so I can't manipulate the data is Power Query and the need doesn't justify going back and modifying that model for this very specific reporting requirement. So I'm left with what I can do with DAX and as I said while I can create additional custom columns, it does not like attempting to cast the string as a numerical value.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 03:55:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4416835#M175388</guid>
      <dc:creator>rpiboy_1</dc:creator>
      <dc:date>2025-02-19T03:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Import Models and limitations on casting values in new columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4416870#M175389</link>
      <description>&lt;P&gt;Could you show some examples (screenshots/code) of where you're&amp;nbsp;trying to convert to date with DAX?&lt;/P&gt;
&lt;P&gt;One way or another, the conversion should be possible.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 04:17:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4416870#M175389</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2025-02-19T04:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Import Models and limitations on casting values in new columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4416883#M175390</link>
      <description>&lt;P&gt;Yes, I can tomorrow.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 04:36:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4416883#M175390</guid>
      <dc:creator>rpiboy_1</dc:creator>
      <dc:date>2025-02-19T04:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Import Models and limitations on casting values in new columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4417838#M175416</link>
      <description>&lt;P&gt;First here is the error message I get when attempting to define a new column w/DAX.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Here is the measure code, broken out for testing/analysis and ititerative construction. Worth noting that this is the most recent iteration. I've also tried casting each unique string component as a number, and then attempting to use the DATE function with no success and a similiar error. It all seems to be point to not being able to convert the text strings into numerical representations.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Closed Date = 
VAR _isClosed = CONTAINSSTRING('Projects'[contract_ref], "Closed")

VAR _result =
    IF(
        _isClosed,
        RIGHT('Projects'[contract_ref], 8),
        BLANK()
    )

VAR _year =
    IF(
        _isClosed,
        LEFT(_result, 4),
        BLANK()
    )

VAR _month =
    IF(
        _isClosed,
        MID(_result, 5, 2),
        BLANK()
    )

VAR _day =
    IF(
        _isClosed,
        RIGHT(_result, 2),
        BLANK()
    )

VAR _finalResult =
    IF(
        _isClosed,
        DATEVALUE(_month &amp;amp; "-" &amp;amp; _day &amp;amp; "-" &amp;amp; _year),
        BLANK()
    )


RETURN
_finalResult&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 13:19:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4417838#M175416</guid>
      <dc:creator>rpiboy_1</dc:creator>
      <dc:date>2025-02-19T13:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Import Models and limitations on casting values in new columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4418525#M175446</link>
      <description>&lt;P&gt;grrr, bad data strikes again. Some more digging and playing with measures and some bad text strings showed up. Have now accounted for that in my logic which will hopefully put the issue to rest, but there is only so much you can do when dealing with an open string field that a user can enter anything they want to.... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 00:58:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4418525#M175446</guid>
      <dc:creator>rpiboy_1</dc:creator>
      <dc:date>2025-02-20T00:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Import Models and limitations on casting values in new columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4418560#M175447</link>
      <description>&lt;P&gt;Glad to hear it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;I was just looking at this and managed to reproduce the issue.&lt;/P&gt;
&lt;P&gt;From the error message, you have a DirectQuery connect to an existing Power BI semantic model and are adding a calculated column in the local model?&lt;/P&gt;
&lt;P&gt;There must have been a column containing "Closed" and ending in "irection" (among the other issues you've found I'm sure) &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, 20 Feb 2025 01:35:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4418560#M175447</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2025-02-20T01:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Import Models and limitations on casting values in new columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4418564#M175449</link>
      <description>&lt;P&gt;Yeah, it was such gibberish in the error message, I didn't realize it was bad text strings and I had not spotted them during previous manual scans of the data. Once it showed up when I started taking a different approach that was purely text based, it was pretty easy to back check and find the 'bad' data.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 01:39:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Import-Models-and-limitations-on-casting-values-in-new-columns/m-p/4418564#M175449</guid>
      <dc:creator>rpiboy_1</dc:creator>
      <dc:date>2025-02-20T01:39:19Z</dc:date>
    </item>
  </channel>
</rss>

