Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Hierarchical Filter & Aggregated Visualizations

 Hello PowerBI Experts,

 

Following up on my previous post, I am now encountering a rather strange issue. 

 

Context

I have monthly usage data from a SaaS software solution. All the monthly usage reports are pushed to the same table, and we have a separate table for a list of customers. The cloud deployment has three tiers of tenant: management, parent, and child. The management tenant is used to operate the platform and customers cannot access it. Customers are given a "parent" tenant, and they can create as many "child" tenants as they want. The data looks something like this:

 

Table 1: Usage Data

MonthTenant NameParent TenantPathUsage Metric(s)
Januarymanagement-management...
Januaryparent1managementmanagement|parent1 
JanuarychildAparent1management|parent1|childA 
JanuarychildBparent1management|parent1|childB 
Januaryparent2managementmanagement|parent2 
JanuarychildCparent2management|parent2|childC 
Februarymanagement-management 
Februaryparent1managementmanagement|parent1 
FebruarychildAparent1management|parent1|childA 
FebruarychildBparent1management|parent1|childB 
Februaryparent2managementmanagement|parent2 
FebruarychildCparent2management|parent2|childC 
...    

 

Table 2: Customer Mapping

Customer NameTenant Name
Customer1parent1
Customer2parent2

 

 

Current Approach

I've built a report such that you can view data on the individual tenant level and at the customer level. I accomplish this using a slicer on "Customer Name":

With a Measure:

 

 

PathContainsTenant = 
var _a = SELECTCOLUMNS('Customer List',"Tenant",[Tenant])
return IF(MAX(Data[Tenant]) in _a || MAX(Data[Parent]) in _a || MAX(Data[Path Level 1]) in _a, 1, 0)

 

 

 

This gives me the list of tenants that have the desired customer tenant in their path. For example, if I select "CustomerA":

You can then see how "PathContainsTenant" becomes my filtering option - to find any relevant tenants, I simply just look for when PathContainsTenant = 1.

 

Using this, I've introduced a Hierarchy Slicer to enable you to look at each tenant individually:

 

The Problem

The graph on the right - "Total API Requests" is intended to be the sum of all API Requests for the selected tenants. However, it is not working as I had intended. In the above screenshot, it works properly, but as soon as I select all tenants for CustomerA, it goes blank:

 

Same thing happens for CustomerB:

 

Strangely, for CustomerC, it aggregates the entire data set (e.g. all tenants, even though the filter is set to only include tenants where PathContainsTenant = 1):

Any ideas on how I can get the graph on the right to sum properly? I will try and attach my working file if the forums will let me. edit - it won't let me attach my file, but the graph is relateively straighforward anyway:

 

 

 

 

No Replies