cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors