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
Anonymous
Not applicable

Is it possible to create de-duplicated hierarchies for drill downs in Power BI?

Hi there,

Here is my dilemma: I have a table of product sales data that looks like this:

63lZ6.png

 

 

 

 

I want to be able to aggregate this data by 'Category'. However, as it is possible that the Apple, Orange and Pear were all purchased within the same order number, the aggregated data (de-duplicated) could look something like this:

0AywQ.png

 

 

 

I have imported the raw data tables to show both levels of aggregation shown above.  How can I create a hierarchy using the data from a combination of these two tables in order to create a dynamic 'Number of Orders' (which is dependent on the level in the hierarchy being displayed)?

I've searched a number of forums and experimented for a few hours on own but cannot find a solution.

Thanks for your help!

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous , 

Did you mean that you want to get below result?

581.PNG582.PNG

 If so, you could try below measure to see whether it work or not

Measure 3 = if(HASONEVALUE('Table'[category]),MIN('Table'[amount]),SUMX(SUMMARIZE('Table','Table'[category], "a", MIN('Table'[amount])),[a]))

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
dax
Community Support
Community Support

Hi @Anonymous , 

Did you mean that you want to get below result?

581.PNG582.PNG

 If so, you could try below measure to see whether it work or not

Measure 3 = if(HASONEVALUE('Table'[category]),MIN('Table'[amount]),SUMX(SUMMARIZE('Table','Table'[category], "a", MIN('Table'[amount])),[a]))

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @dax,

Yes, this is EXACTLY what I've been looking for.  Thank you so much. 

Please can you talk me through how this calculated measure is working (I'm quite new to Power BI)? 😀

dax
Community Support
Community Support

Hi @Anonymous , 

Because for the expression and context the grand total is not work, so we need to redefine the expression for grand total. we need use summarize function to redefine the table and simplify the table stracture which group by category and have a column to show the min value for each category, then you could sum the min column as grand total.  And you also could refer to /hasonevalue-vs-isfiltered-vs-hasonefilter/  for details.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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.