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
Arshadjehan
Helper I
Helper I

Getting Selected Columns for Matrix Visual

Hi,

     I am trying to Display year wise budgetary columns in matrix visual, but NOT all columns from every year.

 

Currently I am getting 6 columns for each year at different categories (rows) level as below:

imgggg.gif

 

But I dont want every column for every year. Like my requirement is to display :

  •       All 6 columns for Year 2019
  •       Only "Actual" columns for 2016, 2017 and 2018
  •      Average of "Actual" columns for 2016, 2017 and 2018.

Any help will be highly appreciated....

 

1 ACCEPTED SOLUTION

hi @Arshadjehan 

If so, you could only try these two workaround:

1. Unpivot the these six columns and then get it as above.

https://radacad.com/pivot-and-unpivot-with-power-bi

2. disable the "Word wrap" in Format-> Column headers of matrix, then reduce the column width to 0 manually for year 2016/2017/2018.

 

Regards,

Lin

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

View solution in original post

6 REPLIES 6
v-lili6-msft
Community Support
Community Support

hi @Arshadjehan 

You could try this way as below:
Step1:

Add a dim categories table as below:

Dim categories = UNION(VALUES('Table'[categories]),ROW("categories","Average of Actual"))

Then create a relationship with basic fact table

Step2:

Create a measrue as below logic:

Measure =
IF (
    SELECTEDVALUE ( 'Dim categories'[categories] ) = "Actual",
    SUM ( 'Table'[Value] ),
    IF (
        SELECTEDVALUE ( 'Table'[Year] ) = 2019,
        SUM ( 'Table'[Value] ),
        IF (
            SELECTEDVALUE ( 'Dim categories'[categories] ) = "Average of Actual",
            CALCULATE(AVERAGE('Table'[Value]),ALL('Table'[Type]),FILTER(ALL('Dim categories'),'Dim categories'[categories]="Actual"))
        )
    )
)

 

or

 

Measure 2 =
IF (
    SELECTEDVALUE ( 'Dim categories'[categories] ) = "Actual",
    SUM ( 'Table'[Value] ),
    IF (
        SELECTEDVALUE ( 'Table'[Year] ) = 2019,
        SUM ( 'Table'[Value] ),
        IF (
            SELECTEDVALUE ( 'Dim categories'[categories] ) = "Average of Actual",
            CALCULATE(AVERAGE('Table'[Value]),ALL('Table'[Year]),FILTER(ALL('Dim categories'),'Dim categories'[categories]="Actual"))
        )
    )
)

 

Result:

1.JPG

And here is sample pbix file, please try it.

 

Regards,

Lin

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

Thanks @v-lili6-msft for detailed answer.

 

But "Categories" you used in sample fact table as ROWS, are actualy columns in my table. 

Here is the sample snapshot;

 

budget table.gif

 

How can I refer to these columns, and get the similar solution you gave, withing the matrix I pointed to in my first post?

hi @Arshadjehan 

If so, you could only try these two workaround:

1. Unpivot the these six columns and then get it as above.

https://radacad.com/pivot-and-unpivot-with-power-bi

2. disable the "Word wrap" in Format-> Column headers of matrix, then reduce the column width to 0 manually for year 2016/2017/2018.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
az38
Community Champion
Community Champion

Hi @Arshadjehan 

there is no such option for matrix visual. you can hide columns only the same for each year

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hi @az38 

Thanks, but how can I hide certain columns for one year and display all columns for other?

az38
Community Champion
Community Champion

@Arshadjehan 

I dont see any chance to do it

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.