Search code examples
powerbicomparisondax

PowerBI DAX error: comparing values of type text with values of type integer


I need help with a PowerBI error. I cannot display any data because of this error I've been receiving from DAX: dax comparison operations do not support comparing values of type text with values of type integer.

It appears that the error is in this part of the formula:

    FILTER('tgv vDimWorkspaceArea', 'tgv vDimWorkspaceArea'[ValidFromKey] <= MaxSelectedDateKey && 'tgv vDimWorkspaceArea'[ValidToKey] >= MinSelectedDateKey),
    FILTER('tgv vDimDeviceWorkspaceAreaParty', 'tgv vDimDeviceWorkspaceAreaParty'[ValidFromKey] <= MaxSelectedDateKey && 'tgv vDimDeviceWorkspaceAreaParty'[ValidToKey] >= MinSelectedDateKey)

I have checked the formats of the "ValidToKey" and "ValidFromKey", they are both in the format of Whole number in the table (e.g. 20220421). Any ideas where else I should look?

Thank you


Solution

  • Check steps:

    1.

    CALCULATE(
        COUNTROWS('dm FactEnviroData_Agr60_new'),
        'dm FactEnviroData_Agr60_new'[ComfortCO2] <> "null"
        ,FILTER(
            'dm DimWorkspaceArea'
            ,'dm DimWorkspaceArea'[ValidFromKey] <= MaxSelectedDateKey 
            && 'dm DimWorkspaceArea'[ValidToKey] >= MinSelectedDateKey
        )
        ,FILTER(
            'dm DimDeviceWorkspaceAreaParty'
            ,'dm DimDeviceWorkspaceAreaParty'[ValidFromKey] <= MaxSelectedDateKey 
            && 'dm DimDeviceWorkspaceAreaParty'[ValidToKey] >= MinSelectedDateKey)
    )
    
    CALCULATE(
        COUNTROWS('dm FactEnviroData_Agr60_new'),
        'dm FactEnviroData_Agr60_new'[ComfortCO2] <> "null"
    )
    
     COUNTROWS(
          FILTER(
             'dm DimWorkspaceArea'
             ,'dm DimWorkspaceArea'[ValidFromKey] <= MaxSelectedDateKey 
              && 'dm DimWorkspaceArea'[ValidToKey] >= MinSelectedDateKey
          )
     )
    

      COUNTROWS(
           FILTER(
              'dm DimWorkspaceArea'
              ,-- 'dm DimWorkspaceArea'[ValidFromKey] <= MaxSelectedDateKey 
               --&& 
              'dm DimWorkspaceArea'[ValidToKey] >= MinSelectedDateKey
           )
      )
    
     COUNTROWS(
          FILTER(
             'dm DimWorkspaceArea'
             ,'dm DimWorkspaceArea'[ValidFromKey] <= MaxSelectedDateKey 
              -- && 'dm DimWorkspaceArea'[ValidToKey] >= MinSelectedDateKey
          )
     )