Forum Discussion

nikkirai99's avatar
nikkirai99
Frequent Visitor
1 year ago
Solved

Error fetching data for this visual - column, relationship or measure not in a valid state

I have a Table 1 which is the main table called 'Main' and Table 2 called 'Reason Codes'.  Table 1 has 100 rows. Table 2 has 5 rows which match Table 1.   My calculated column is below: If(     ...
  • rajendraongole1's avatar
    1 year ago

    Hi nikkirai99  - Your formula itself is correct for what it intends to do, the way the RELATED function works in DAX and the setup of relationships between your tables.there is a one-to-many relationship between Reason Codes (one side) and Main (many side).

     

    create simple measure as like below for test:

    TestColumn = RELATED('Reason Codes'[ReasonCodeDate])

    If this also results in an error, the issue is with the relationship.  still, If the relationship is valid but still causes issues, try an alternative approach using LOOKUPVALUE

     

    ReasonCodeDateResolved =
    LOOKUPVALUE(
    'Reason Codes'[ReasonCodeDate],
    'Reason Codes'[ReasonCodeID], 'Main'[ReasonCodeID]
    )

     

    This formula does not depend on the RELATED function and works even with inactive relationships.Focus on verifying the relationship between the tables and testing the logic with simpler measures.