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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
sureshg2498
Advocate I
Advocate I

Moving the cell value in Matrix visual

Hi All,

We have the sample data set as shown below.

IndexFiscal QuarterCustomer NameHealthRegion
1FY Q1 2024T MobileREDSouth
2FY Q1 2024J&JGREENCentral
3FY Q2 2024WallmartGREENWest
4FY Q4 2024SAPYELLOWEast
5FY Q1 2023APPLEREDSouth
6FY Q2 2023AmazonYELLOWSouth
7FY Q2 2023NetFlexGREENWest
8FY Q2 2023AhaREDCentral
9FY Q2 2024SamsungYELLOWWest
10FY Q2 2023MotoREDWest

 

I have created the Matrix visual as shown below.Conditional formatting is based on Health field.

 

sureshg2498_2-1738691663119.png

 

sureshg2498_0-1738691362696.png

Customer Name Conditional formatting is based on Health field.

sureshg2498_1-1738691534696.png

DAX for "Custom Index" column

Custom Index =
VAR CurrentQuarter =Sheet1[Fiscal Quarter]
VAR SortedTable =
    FILTER (
       Sheet1,
       Sheet1[Fiscal Quarter] = CurrentQuarter

    )
RETURN
    RANKX((SortedTable),Sheet1[Index], , ASC,Dense)

 

Issue:

When i select the Slicer Region as  "West" report displays the data as shown below.

sureshg2498_3-1738691773813.png

But our expected results are as below.We do not need the empty cell.

sureshg2498_4-1738691848318.png

When we uncheck the "West"  it should go to the default view.

sureshg2498_0-1738691362696.png

 

Could anyone please help me on it.

 

 

Thanks,

Suresh.

@danextian  @lbendlin @rajendraongole1 @johnt75 @Ritaf1983 @Bibiano_Geraldo @DataNinja777 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

lbendlin_0-1738705547871.png

No need for RANKX.

View solution in original post

4 REPLIES 4
Bibiano_Geraldo
Super User
Super User

HI @sureshg2498 ,

Since the custom index is a calculated column, it is not possible to recalculate its order when filtering by region or using any slicer in your report. This happens because calculated columns do not update dynamically based on applied filters.

If the index were a measure, it could be recalculated dynamically, but the issue is that measures cannot be placed in the row fields of a matrix.

Alternative Solution

One way to work around this limitation is by creating a rank for each region. However, this approach increases the size of the data model, so it is not recommended.

Here’s the process:

  1. Create a ranking column for each region.
  2. Create a field parameter based on these ranking columns.
  3. Establish a relationship between the parameter table and the main table (Sheet1).
  4. Use the parameter column in the matrix row fields and as a slicer in the report.

This will allow the filters to be applied correctly and display the expected results.

Example DAX Code for Ranking by Region

The following DAX code creates a ranking for the East region, filtering only the data for that region when calculating the rank, repeat this for others:

East = 
VAR CurrentQuarter =Sheet1[Fiscal Quarter]
VAR SortedTable =
    FILTER (
       Sheet1,
       Sheet1[Fiscal Quarter] = CurrentQuarter && Sheet1[Region] = "East"

    )
RETURN
    RANKX((SortedTable),Sheet1[Index], , ASC,Dense)

Bibiano_Geraldo_0-1738706441148.png

 

The output expected:

Bibiano_Geraldo_1-1738706674873.png

 

Important Note

This is not best practice because the ranking columns are not created dynamically. This means that if new regions are added in the future, you will need to manually update the parameter table and create new columns for the additional regions.

Additionally, if you are working with large datasets, this approach can significantly increase the size of your model.

 

 

Thank you so much Bibiano.Your insights were incredibly helpful. I really appreciate the time you took to guide me.

lbendlin
Super User
Super User

lbendlin_0-1738705547871.png

No need for RANKX.

Thank you so much IbendIin. Your assistance was incredibly helpful.Thank you for taking the time to help me solve that problem. Your expertise was invaluable. I wanted to take a moment to express my gratitude for your assistance with my issue. I really appreciate it. Thank you once again!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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