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
srkase
Helper IV
Helper IV

MEASURE SHOWING TWO TIMES - COLUMN SHOWING TWO TIMES

111.jpg

 

I have created a matrix and added a measure to find the percentage of spares on product value... the % of spares is showed two times in the matrix...  I want it to be shown only once after the spares value...

 

kindly help me in this regards...

 Thanks in advance,,

 

1 ACCEPTED SOLUTION


@srkase wrote:

i am just a beginner in power bi.. can you explain me in detail?


Explain what specifically - changing the measure to return blank if the category is not "spare"?

 

If so, something like the following will do that. Note that the [% of spares] column would still appear for each category in your matrix visual, it will just be blank unless the category is spares.

 

% of Spares =
VAR _products = CALCULATE(
SUM( PROD_CABLE[TOTALVAL]),
PROD_CABLE[CATEGORY] = "PRODUCT"
)
VAR _spares = CALCULATE(
SUM( PROD_CABLE[TOTALVAL]),
KEEPFILTERS(PROD_CABLE[CATEGORY] = "SPARES"),
KEEPFILTERS(PROD_CABLE([MINOR GROUP] in {"outsource","spares","solar","ctrl panel" } )
)
RETURN DIVIDE(_spares, _products) * 100

View solution in original post

6 REPLIES 6
d_gosbell
Super User
Super User

This is the expected behaviour. It looks like you have 2 categories selected (PRODUCTS and SPARES) so the matrix control will display every measure in the Values setting for every category.

 

If you only want the value to calculate under spares and would like the column to be blank under products you could wrap the PROD_CABLE[CATEGORY] = "SPARES" in the _spares variable in the KEEPFILTERS() function

i am just a beginner in power bi.. can you explain me in detail?


@srkase wrote:

i am just a beginner in power bi.. can you explain me in detail?


Explain what specifically - changing the measure to return blank if the category is not "spare"?

 

If so, something like the following will do that. Note that the [% of spares] column would still appear for each category in your matrix visual, it will just be blank unless the category is spares.

 

% of Spares =
VAR _products = CALCULATE(
SUM( PROD_CABLE[TOTALVAL]),
PROD_CABLE[CATEGORY] = "PRODUCT"
)
VAR _spares = CALCULATE(
SUM( PROD_CABLE[TOTALVAL]),
KEEPFILTERS(PROD_CABLE[CATEGORY] = "SPARES"),
KEEPFILTERS(PROD_CABLE([MINOR GROUP] in {"outsource","spares","solar","ctrl panel" } )
)
RETURN DIVIDE(_spares, _products) * 100

this works ..

 

Further i am not getting the percentages when the same is drilled down? what could be the reason?

 


@srkase wrote:

this works ..

 

Further i am not getting the percentages when the same is drilled down? what could be the reason?

 


I don't understand what you mean here. You'll need to explain in more detail or provide some screenshots. 

did a small change in the keepfilters()...

 

now working fine..

 

thanks dude

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.