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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
mrbrewmaster
Regular Visitor

Relationship status impacting data visualization?

I apologize in advance; I am still very new to Power BI and the whole Power Platform.

 

I am using a custom order entity in Power Apps (CDS) to track order requests from customers. This order entity references three other entities via lookup fields. The first is to reference a current customer entity so I can attribute the order to them. The second is to reference a current brand entity of available brands. The third is to reference a current size entity of available sizes. A category quantity field for each Brand/Size combination. Finally, I have a calculated field to give me a subtotal for each combination of Brand/Size/Quantity. I have limited each order to one customer, and up to four combinations (for now).

 

I have imported this entity, and each of the reference entities into Power BI so I can start to visualize the order data. I have established relationships between:

  • The customer entity (unique ID) and the customer field on the order.
  • The size entity (unique ID) and the each of the four size fields (size1, size2, size3, size4) on the order.
  • The brand entity (unique ID) and each of the four brand fields (brand1, brand2, brand3, brand4) on the order.

I am still learning the exact nature of the relationships.

 

Example:

Order 1- Customer A

Brand: A

Brand: B

Brand: C

Brand: A

Size: A

Size: A

Size: B

Size: B

Count: 10

Count: 2

Count: 10

Count: 10

Subtotal: $100

Subtotal: $20

Subtotal: $50

Subtotal: $50

 

Order 2- Customer B

Brand: D

Brand: A

Brand: B

null

Size: A

Size: A

Size: B

null

Count: 5

Count: 10

Count: 5

null

Subtotal: $50

Subtotal: $100

Subtotal: $25

null

 

When I visualize my data, I can get a total count of both orders, or total $ of both orders graphed by the Customer. I suspect it is because there is a single customer (and thus relationship between entities) per order. If I attempt (in a pie chart) to get a total count or total $ across all orders, with the Brand or Size as the legend, it will show the correct count or total $ but the chart will show those numbers split between each order’s Brand A (or size A). If I change which relationship is active the visualization will reflect that too.

 

Ideally, I want to be able to have a Pie Chart that shows total $ or count across all orders, with a date hierarchy, and the product mix graphed by brand with a size filter.

 

Any guidance is greatly appreciated! Thank you!

1 ACCEPTED SOLUTION
mrbrewmaster
Regular Visitor

As I suspected the solution came down to my improper use of the Relations between entities. I spent some more time familiarizing myself with DAX. Specifically the USERELATIONSHIP function and managed to bypass the troublesome active relationship and specify a sales volume with a brand. 

 

Sorry for the confusing nature of my previous replies. I am still very new to this. I appreciate all the attempts to help clarify.

 

 

Total Volume (Filtered) = CALCULATE(SUM(volume1]), USERELATIONSHIP(brandid],brand1]))
+ CALCULATE(SUM(volume2]), USERELATIONSHIP(brandid],brand2]))
+ CALCULATE(SUM(volume3]), USERELATIONSHIP(brandid],brand3]))
+ CALCULATE(SUM(volume4]), USERELATIONSHIP(brandid],brand4]))

 

 

Annotation 2020-07-17 185208.pngAnnotation 2020-07-17 185227.png

View solution in original post

6 REPLIES 6
mrbrewmaster
Regular Visitor

As I suspected the solution came down to my improper use of the Relations between entities. I spent some more time familiarizing myself with DAX. Specifically the USERELATIONSHIP function and managed to bypass the troublesome active relationship and specify a sales volume with a brand. 

 

Sorry for the confusing nature of my previous replies. I am still very new to this. I appreciate all the attempts to help clarify.

 

 

Total Volume (Filtered) = CALCULATE(SUM(volume1]), USERELATIONSHIP(brandid],brand1]))
+ CALCULATE(SUM(volume2]), USERELATIONSHIP(brandid],brand2]))
+ CALCULATE(SUM(volume3]), USERELATIONSHIP(brandid],brand3]))
+ CALCULATE(SUM(volume4]), USERELATIONSHIP(brandid],brand4]))

 

 

Annotation 2020-07-17 185208.pngAnnotation 2020-07-17 185227.png

Anonymous
Not applicable

Hi @mrbrewmaster ,

Could you please provide your expected result in the form of table or screen shot? And what's the calculation logic of total $ or count? size1count+size2count+size3count+size4count? The information in this table which post in your latest post is a bit confusing, could you please explain the source of these data and its actual application scenario? It may need to make some adjustments according to your needs later...

In addition, you can refer the following blog to create the related pie chart.

How to Create a Power BI Pie Chart

Best Regards

Rena

@Anonymous Apologies, the last post was a slightly redacted table as it exports from the entity in Power Apps. Below is a slightly easier to read example table (Ex.1) with similar content to my real table. I am utilizing Power Apps entities in CDS to track orders via a Model-based app. So every new submittal adds a row to the table.

Ex. 1

mrbrewmaster_0-1593112144327.png

 

Ideally I would be able to take this data and transform it into a combination table like in the following example (Ex. 2).

Ex.2 

mrbrewmaster_1-1593112452462.png 

Then I could utilize the columns to make my pie chart as below (Ex.3a and 3b).

Ex. 3a

mrbrewmaster_5-1593112835073.png

Ex.3b

mrbrewmaster_6-1593112887439.png

And presumably filter in Power BI similarly to how I can in Excel (Ex. 4a and 4b)

Ex.4a

mrbrewmaster_7-1593113073597.png

Ex.4b

mrbrewmaster_8-1593113097813.png

 

Or combine separate volumes between the same brand to get a total volume per brand (Ex.5a and 5b)

Ex.5a

mrbrewmaster_9-1593113253463.png

Ex.5b

mrbrewmaster_10-1593113282951.png

 

In the actual instance. I have a measure created to calculate Total Volume. However when I apply the brand list in the Legend field it only labels the brands present in the first brand field from the entity (which is the active relationship, brand1 to brandlist). If I change which relationship is active, the brands shown will also change. In both cases the volume remains correct. It is only attributed to the active relationship brand.

mrbrewmaster_11-1593113529838.png 

mrbrewmaster_12-1593113666896.png

 

I am also open to changing the way things are saved to the entity or adding fields as needed to preempt Power Query or Calculations in Power BI. 

 

I hope that all made sense. I am happy to continue to clarify as I am able (from an ability standpoint).

 

 

mrbrewmaster
Regular Visitor

To clarify, the data table in Power BI looks like this

 

Cust.

Brand 1

Brand 2

Brand 3

Brand 4

Brand 1 Size

Brand 2 Size

Brand 3 Size

Brand 4 Size

Brand 1 Count

Brand 2 Count

Brand 3 Count

Brand 4 Count

Customer A ID

A

B

C

A

A

A

B

B

10

2

10

10

 

Customer B ID

D

A

B

null

A

A

B

null

5

10

5

null

@mrbrewmaster , is your data is in the format you have mentioned in the first post and you want data like your second post ??

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandakMy data looks like in my second post. Here is a table grab from my test.

 

distributionidsize1countsize1volumesize2countsize2volumesize3countsize3volumesize4countsize4volumeinvoice_namepickupdatetimedistribution_accountbrand1brand2brand3brand4size1size2size3size4
bd79c36c-66b5-ea11-a812-000d3a8a493410.520.322121TEST-06-23-20-10006/26/2020 17:00c8f7cfe0-65b5-ea11-a812-000d3a8a4934e0faa3ac-f299-ea11-a811-000d3a8a4934e0faa3ac-f299-ea11-a811-000d3a8a4934ada2a2e8-09a1-ea11-a812-000d3a8a493457e48445-85b2-ea11-a812-000d3a8a4934e7d7c02a-0fa1-ea11-a812-000d3a8a49349d35d35b-0fa1-ea11-a812-000d3a8a4934e7d7c02a-0fa1-ea11-a812-000d3a8a4934e7d7c02a-0fa1-ea11-a812-000d3a8a4934
fb63c6ef-c3b5-ea11-a812-000d3a8a493410.510.5    TEST-06-24-20-10047/10/2020 15:00fc78dc14-2e9a-ea11-a811-000d3a8a49344258c728-f399-ea11-a811-000d3a8a4934ee10d0d0-88b2-ea11-a812-000d3a8a4934  e7d7c02a-0fa1-ea11-a812-000d3a8a4934e7d7c02a-0fa1-ea11-a812-000d3a8a4934  
e1372cc3-c3b5-ea11-a812-000d3a8a493431.521    TEST-06-24-20-10038/3/2020 15:00fc78dc14-2e9a-ea11-a811-000d3a8a493453cda586-9768-ea11-a811-000d3a8a49341838cc6e-f099-ea11-a811-000d3a8a4934  e7d7c02a-0fa1-ea11-a812-000d3a8a4934e7d7c02a-0fa1-ea11-a812-000d3a8a4934  
11620893-c3b5-ea11-a812-000d3a8a493410.16      TEST-06-24-20-10028/5/2020 17:00c8f7cfe0-65b5-ea11-a812-000d3a8a49344258c728-f399-ea11-a811-000d3a8a4934   9d35d35b-0fa1-ea11-a812-000d3a8a4934   
16dc4bc9-c2b5-ea11-a812-000d3a8a493410550.82181.28TEST-06-24-20-10017/1/2020 17:00c8f7cfe0-65b5-ea11-a812-000d3a8a493464c19bbc-f299-ea11-a811-000d3a8a4934ee10d0d0-88b2-ea11-a812-000d3a8a4934ada2a2e8-09a1-ea11-a812-000d3a8a49347b55a5fd-09a1-ea11-a812-000d3a8a4934e7d7c02a-0fa1-ea11-a812-000d3a8a49349d35d35b-0fa1-ea11-a812-000d3a8a4934e7d7c02a-0fa1-ea11-a812-000d3a8a49349d35d35b-0fa1-ea11-a812-000d3a8a4934

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors