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

dynamic dimension by select all or single value

Hi Experts,

 

Suppose we have region and city and a user selected filter by region.

If user chose one single region, there is a monthly trend line chart by city.( cities for each line by selected single region)

If user chose all or multiple region, there is a monthly trend line chart by region.(regions for each line)

Anyone can help?

 

Best Regards

Bruce Chen

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can create a calculated table to work on it. One sample for your reference. Please check the following steps as below.

1. Create a calculated table and make it related to the fact table.

di = UNION(VALUES('Table'[city]),VALUES('Table'[region]))

2.PNG

2. Then we can create a measure as below to get the excepted result as we need.

Measure = 
IF (
    ISFILTERED ( 'Table'[city] ),
    SUM ( 'Table'[amount] ),
    IF (
        ISFILTERED ( 'Table'[region] ),
        CALCULATE (
            SUM ( 'Table'[amount] ),
            USERELATIONSHIP ( di[city / region], 'Table'[region] )
        )
    )
)

Capture.PNG

 

BTW, pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can create a calculated table to work on it. One sample for your reference. Please check the following steps as below.

1. Create a calculated table and make it related to the fact table.

di = UNION(VALUES('Table'[city]),VALUES('Table'[region]))

2.PNG

2. Then we can create a measure as below to get the excepted result as we need.

Measure = 
IF (
    ISFILTERED ( 'Table'[city] ),
    SUM ( 'Table'[amount] ),
    IF (
        ISFILTERED ( 'Table'[region] ),
        CALCULATE (
            SUM ( 'Table'[amount] ),
            USERELATIONSHIP ( di[city / region], 'Table'[region] )
        )
    )
)

Capture.PNG

 

BTW, pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Unfortunately, there is no way to switch dynamically between columns or use measures in the Legend field of visuals, however, it would be a very powerful future.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

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.