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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.