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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
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

slacey7070_1-1622907274349.png

 

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)

slacey7070_2-1622907558383.png

 

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
Ashish_Mathur
Super User
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
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
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
https://www.linkedin.com/in/excelenthusiasts/

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.

 

NMEG_0-1692066032049.png

Thank you in advance

NG

 

 

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


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thank you Ashish, your solution worked perfect!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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