Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
JustinDoh1
Post Prodigy
Post Prodigy

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:

JustinDoh1_0-1626290165855.png

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"

JustinDoh1_1-1626290293427.png

 

Expected output for May 2021:

JustinDoh1_0-1626290444780.png

 

Thanks for help!

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

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]
)

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

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]
)

@AlexisOlson It is amazing how you come up with the solution. I appreciated it so much for your help!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.