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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Relationships between two columns

Hi there,

 

I have 3 tabs in my data file, each with a 'time period' and 'visitor type' column, which I wanted to join the files by, and also use as slicers. Unfortunately, I can only create a relationship between the 3 tables using the time period column. 

 

Is there any way I can also link by 'visitor type'? So then I can have 'time period' and 'visitor type' as slicers across all data?

 

sonial_0-1592887643133.png

 

sonial_1-1592887710707.png

 

I hope this makes sense! 

 

Also worth noting, my time period column is exported as aggregated periods of time 'last 7 days, last 30 days' etc., not as an actual date group. 

 

Thanks, 

Sonia

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @Anonymous 

You can create two lookup tables that contain the Visitor Types and Time Periods from all 3 tables.  Then you hook all 3 tables into the look tables and pull your slicers from the lookup tables.

Home > New Table

Visitor Types =
DISTINCT (
    UNION (
        DISTINCT ( Gender[Visitor Type] ),
        DISTINCT ( Overall[Visitor Type] ),
        DISTINCT ( Platform[Visitor Type] )
    )
)

 and another new table

Time Periods =
DISTINCT (
    UNION (
        DISTINCT ( Gender[Time Period] ),
        DISTINCT ( Overall[Time Period] ),
        DISTINCT ( Platform[Time Period] )
    )
)

 

 

View solution in original post

4 REPLIES 4
jdbuchanan71
Super User
Super User

Hello @Anonymous 

You can create two lookup tables that contain the Visitor Types and Time Periods from all 3 tables.  Then you hook all 3 tables into the look tables and pull your slicers from the lookup tables.

Home > New Table

Visitor Types =
DISTINCT (
    UNION (
        DISTINCT ( Gender[Visitor Type] ),
        DISTINCT ( Overall[Visitor Type] ),
        DISTINCT ( Platform[Visitor Type] )
    )
)

 and another new table

Time Periods =
DISTINCT (
    UNION (
        DISTINCT ( Gender[Time Period] ),
        DISTINCT ( Overall[Time Period] ),
        DISTINCT ( Platform[Time Period] )
    )
)

 

 

Anonymous
Not applicable

Amazing, thank you so much, @jdbuchanan71 

Anonymous
Not applicable

One more question, @jdbuchanan71  - do you know how I can rank my time period (7 days through to 90 days)? I thought to add a column with 1,2,3,4 and then sort by that, but couldn't seem to enter the data... 

 

Thanks again!

You can add another column to the table in the same step as when you create it.

Time Periods = 
ADDCOLUMNS(
    DISTINCT (
        UNION (
            DISTINCT ( Gender[Time Period] ),
            DISTINCT ( Overall[Time Period] ),
            DISTINCT ( Platform[Time Period] )
        )
    ),
    "Time Period Sort",
    SWITCH( 
        [Time Period],
        "Last 7 days",1,
        "Last 30 days",2,
        "Last 90 days",3,
        99
    )
)

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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