Forum Discussion

JustinDoh1's avatar
JustinDoh1
Icon for Post Prodigy rankPost Prodigy
5 years ago
Solved

How do I apply TREATAS or create a virtual relationship?

I am trying to apply virtual relationship using TREATAS with the code that I have or modify current code to make it work.

 

I am sharing my Pbix file here.

 

I am trying to fix measure called "Col2".

Here is current code:

Expected outcome for Col2 should be  27.333 for Royal T and 79.333 for Royal P (for May 2021).

But, because there is no relationship, outcome just got all mixed up from this table called "Index".

 

table "Index"

 

Expected output for May 2021:

 

Thanks for help!

 

  • If you're trying to match the Rating in that table, why not something much simpler like

     

    Col2 = 
    IF (
        HASONEVALUE ( Main[ProviderName] ),
        VAR Rating = [Rating]
        RETURN
            CALCULATE (
                SELECTEDVALUE ( Index[IndexPoint] ),
                Index[IndexRating] = Rating
            )
    )

     

    or even

    Col2 =
    LOOKUPVALUE (
        Index[IndexPoint],
        Index[ProcessingDate], SELECTEDVALUE ( 'Date Bridge'[ProcessingDate] ),
        Index[IndexRating], [Rating]
    )

2 Replies

  • If you're trying to match the Rating in that table, why not something much simpler like

     

    Col2 = 
    IF (
        HASONEVALUE ( Main[ProviderName] ),
        VAR Rating = [Rating]
        RETURN
            CALCULATE (
                SELECTEDVALUE ( Index[IndexPoint] ),
                Index[IndexRating] = Rating
            )
    )

     

    or even

    Col2 =
    LOOKUPVALUE (
        Index[IndexPoint],
        Index[ProcessingDate], SELECTEDVALUE ( 'Date Bridge'[ProcessingDate] ),
        Index[IndexRating], [Rating]
    )