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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
Stanzarectah
Regular Visitor

Hide a measure in table visual using SelectedValue

Hi,

 

I am using the following measure - 'Metrics' to display in my table visual:

 

Metrics =
var Selection = SELECTEDVALUE('MeasureTable_Metrics'[Category])
RETURN
SWITCH(
TRUE(),
Selection = "Revenue|Actual", MeasureTable_PL[TotalRevenue],
Selection = "Revenue|Budget", MeasureTable_PL[TotalRevenue_Budget],
Selection = "Revenue|Difference ($)", MeasureTable_PL[TotalRevenue] - MeasureTable_PL[TotalRevenue_Budget],
Selection = "Revenue|Difference (%)", (MeasureTable_PL[TotalRevenue] - MeasureTable_PL[TotalRevenue_Budget])/MeasureTable_PL[TotalRevenue_Budget],
Selection = "Revenue|Prior Year", MeasureTable_PL[TotalRevenue_LY],
Selection = "Revenue|Prior Year|Difference ($)", MeasureTable_PL[TotalRevenue] - MeasureTable_PL[TotalRevenue_LY],
Selection = "Revenue|Prior Year|Difference (%)", (MeasureTable_PL[TotalRevenue] - MeasureTable_PL[TotalRevenue_LY])/MeasureTable_PL[TotalRevenue_LY],
Selection = "Cost of Goods Sold|Actual", MeasureTable_PL[TotalCOGS],
Selection = "Cost of Goods Sold|Budget", MeasureTable_PL[TotalCOGS_Budget],
Selection = "Cost of Goods Sold|Difference ($)", MeasureTable_PL[TotalCOGS] - MeasureTable_PL[TotalCOGS_Budget],
Selection = "Cost of Goods Sold|Difference (%)",(MeasureTable_PL[TotalCOGS] - MeasureTable_PL[TotalCOGS_Budget])/MeasureTable_PL[TotalCOGS_Budget],
Selection = "Cost of Goods Sold|Prior Year", MeasureTable_PL[TotalCOGS_LY],
Selection = "Cost of Goods Sold|Prior Year|Difference ($)", MeasureTable_PL[TotalCOGS] - MeasureTable_PL[TotalCOGS_LY],
Selection = "Cost of Goods Sold|Prior Year|Difference (%)", (MeasureTable_PL[TotalCOGS] - MeasureTable_PL[TotalCOGS_LY])/MeasureTable_PL[TotalCOGS_LY],
Selection = "Expenses|Actual", MeasureTable_PL[TotalExpense],
Selection = "Expenses|Budget", MeasureTable_PL[TotalExpense_Budget],
Selection = "Expenses|Difference ($)", MeasureTable_PL[TotalExpense] - MeasureTable_PL[TotalExpense_Budget],
Selection = "Expenses|Difference (%)", (MeasureTable_PL[TotalExpense] - MeasureTable_PL[TotalExpense_Budget])/MeasureTable_PL[TotalExpense_Budget],
Selection = "Expenses|Prior Year", MeasureTable_PL[TotalExpense_LY],
Selection = "Expenses|Prior Year|Difference ($)", MeasureTable_PL[TotalExpense] - MeasureTable_PL[TotalExpense_LY],
Selection = "Expenses|Prior Year|Difference (%)", (MeasureTable_PL[TotalExpense] - MeasureTable_PL[TotalExpense_LY])/MeasureTable_PL[TotalExpense_LY],
Selection = "Blank", 0,
0
 
All works fine however, I do not want to show the colmn 'Category' in my visual as this is used solely to determine the values for the field 'Metrics
 
Stanzarectah_0-1654755071153.png

 

When I removed the field 'Category' the measure 'Metrics' no longer calculates correctly  - this is expected behaviour as the measure used SELECTEDVALUE which is contexual (all values become 0 for the measure).

 

Is there a way to reference the Catgeory column without disaplying it on the visual and still have the measure calculate correctly?

 

Stanley 

 

 

6 REPLIES 6
Dhacd
Resolver III
Resolver III

Just checking, can you confirm whether the name and category columns are in a single table?

@Dhacd ,

 

Yes they are

Use a matrix visual and turn on the stepped layout and in the row headers turn off +/- icon this is the closest we can do I believe.

Unfortunbately this doesn't solve my issue. I get he following:

 

Stanzarectah_0-1654779175539.png

 

rajulshah
Super User
Super User

Hello @Stanzarectah ,

 

You can change the color of rows to any one color, let's say, white.

Then change the font color of both the values and the title to white.

 

Maybe this can be nearer to hiding the column as there is no feature present in Power BI now.

Yes, I have tried that a as a work around but was wondering if there is another way.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.