cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
aznariy Frequent Visitor
Frequent Visitor

Unable to draw multiple lines on line chart correctly

Alright, it's been a month now and I am exausted in looking for a solution online. I believe I have tried all the known solutions. Let me describe the problem below

 

I have a simple table

PowerBiProblem.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If I do matrix on this table, I got following results (and they are right):

PowerBiProblem.png

 

 

 

 

 

 

 

However, if I try to place those values on line chart, numbers messed up

PowerBiProblem.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This is my settings for line chart

PowerBiProblem.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

What magic needs to be done so that numbers are displayed correctly on line chart as in martix? Please advise whoever faced the same problem in PowerBi. Thanks!

1 REPLY 1
Super User
Super User

Re: Unable to draw multiple lines on line chart correctly

Hi @aznariy,

 

The question you have is related with the row context of your data. When you place one of the date columns on your chart as axis, this set the context of the chart so the count of the dates is not made by the value of each date but by the one that you place on the axis.

 

 What I mean with this is that since you are using the Createdate as your axis, if you have 7 records with CrreatedDate for january 1st all of the others columns are also 7 records you will never get the count of january 2nd because your context is the createdate.

 

On the matrix / table since you are using the other date columns for context you have the correct results.

 

You need to do the following:

  • Create a calendar table
  • Create inactive relationship between the calendar table and all your date columns
  • Create the following measures:

 

Create =
CALCULATE (
    COUNT ( Table1[CreatedDate] );
    USERELATIONSHIP ( Table1[CreatedDate]; 'Calendar'[Date] )
)


Activated =
CALCULATE (
    COUNT ( Table1[ActivatedDate] );
    USERELATIONSHIP ( Table1[ActivatedDate]; 'Calendar'[Date] )
)


Closed =
CALCULATE (
    COUNT ( Table1[ClosedDate] );
    USERELATIONSHIP ( Table1[ClosedDate]; 'Calendar'[Date] )
)


Resolved =
CALCULATE (
    COUNT ( Table1[ResolvedDate] );
    USERELATIONSHIP ( Table1[ResolvedDate]; 'Calendar'[Date] )
)

 

 

  • Use your calendar table as a x-axis and add your measures to the values the end result is below:

 

dates.png

 

If you need sample of PBIX file please tell.

 

Regards,

MFelix

 



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

Proud to be a Datanaut!