cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Anonymous
Not applicable

## How do I not display calculated metric values at higher levels of aggregation in hierarchy?

Hi,

• I'm creating a measure called "no_days_on_promo" to calculate the number of days a product/sku is was on sale.
• I have a table, that has multiple levels of aggregation.
• Channel
• Store
• Sku
• The metric is working at the sku level. However, when drilled up to Channel or Store level, I do not want to show the values at this level of aggregation. Is there a way to remove the values at these higher levels of aggregation?
• If not, do you see anything in my code (below) that could summarize the data in a way that actually sums the # of days that all skus were on sale in that channel/store?

E.g. of the metric working at sku level

E.g. of the metric aggregating in a non-meaningful way at the channel and store levels, while also not summing properly (e.g. 500+369 != 556)

Calculated Metric DAX

no_days_on_promo = COUNTX( SUMMARIZE( FILTER(v_agg_date_store_sku_comp_filtered, v_agg_date_store_sku_comp_filtered[promo] = 1), v_agg_date_store_sku_comp_filtered[sku_no], v_agg_date_store_sku_comp_filtered[trans_date], "promo_sku_date", DISTINCTCOUNT(v_agg_date_store_sku_comp_filtered[promo])), COUNT([promo_sku_date]))

Thanks so much

1 ACCEPTED SOLUTION
Super User

Hi,

Try this measure

=if(hasonevalue(v_agg_date_store_sku_comp_filtered[sku_no]),[no_days_on_promo],blank())

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
5 REPLIES 5
Super User

Hi,

Try this measure

=if(hasonevalue(v_agg_date_store_sku_comp_filtered[sku_no]),[no_days_on_promo],blank())

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
Regular Visitor

Hi Ashish

I am hoping you can help me. I have the opposite problem to what is above. How do I not display the returned value of a calcaluated measure at the detail level? I only want to show it at the higher level.

The reason for this is because it is duplicating the result at the detail level and reads misleading. The account manager is only going to receive \$5000. Example below.

NG

Super User

You will have to IF(), HASONEVALUE() functions.

Regards,
Ashish Mathur
http://www.ashishmathur.com
Anonymous
Not applicable

Thank you Ashish, your solution worked perfect!

Super User

You are welcome.

Regards,
Ashish Mathur
http://www.ashishmathur.com