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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
jthomson
Solution Sage
Solution Sage

Stacked area chart legend issues

Hi,

 

Having some troubles getting a visual to display as I like. Here's my data model, or at least the relevant parts of it, as it may be relevant to the measures used:

 

jthomson_0-1616432601056.png

 

NEWREN is a list of insurance policies which I need to relate to everything to create global filters. DCL is a list of claims on those policies, while GEP is a list of earnings based on those policies - tables are linked on a policy number. Date table does what it says on the tin, and is linked to DCL and GEP by file opened date and earnings date respectively.

 

I need to create a measure which basically compares the number of claims received to the amount of years of policies which have already expired. Here's the relevant measures:

 

Frequency = divide([Claim Count],[CumulativeVYE])
 
Claim Count = CALCULATE(countrows(dcl),filter(ALLSELECTED(dcl),DCL[File Opened]<max(DateTable2[Date])))
 
CumulativeVYE = CALCULATE(countrows(GEP)/365,filter(all(DateTable2[Date]),DateTable2[Date]<=max(DateTable2[Date])),USERELATIONSHIP(GEP[GEPDate],DateTable2[Date]))
 
These measures all work individually fine, and they give me a graph which works as intended.
 
The issue comes when I want to split the frequency measure down by fields in the DCL table, for example by accident type. Right now, the overall frequency is, say, 12.5%. If I put the accident type field into "filters on this page" and pick one from there, it will correctly filter - it will show road traffic accidents at 7.5%, and anything else as the correct amounts combining up to the remaining 5%. However, if instead I put the accident type field as a legend in a stacked area chart, I get the following result:
 
jthomson_1-1616433267391.png

Rather than filling the area by the level of each type, it's duplicating the overall area over and over. Any ideas as to why this might be happening and how to modify the formulas to make this work?

1 ACCEPTED SOLUTION

I've just ended up making individual measures for each way I want to split it out and it works, not ideal but it'll have to do. Cannot share the pbix

View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @jthomson ,

 

It's difficult to pin point the error, I see that you have an inactive relationship between two tables however I don't know if that influences the result since the measures arent explicit asbout that.

 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



I've just ended up making individual measures for each way I want to split it out and it works, not ideal but it'll have to do. Cannot share the pbix

Don't forget to mark the correct answer.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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