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
aznariy
Advocate I
Advocate I

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!

8 REPLIES 8
e0318476
Helper I
Helper I

Hi Miguel,

I have understood your DAX function. Sincerely thankful for your help in this. 

 

Cheers!

MFelix
Super User
Super User

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

 


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



Hi,

Appreciate if you could share the PBIX file. Thank you!

Hi @e0318476 ,

 

Please check the PBIX file attach.


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



Hi MFelix,

 

Thank you for your reply. I am working on a file and I am having issues to solve it after viewing your PBIX. Would really appreciate if you could help me with this dataset. 

e0318476_0-1633511284473.png

 

With the sample set above, I would like to acheive this result:

photo6262286154539839230.jpg

Thank you!

Hi @e0318476 

 

Check the file attach.

 

 


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



Annotation 2021-10-25 092618.png

Hi Miguel,

I am facing issues with drilling down my data. For example, I want to look at who have registered for a course the month of July. When I click on the graph, it does not give a drill down of the names. 

 

Please help if possible. Thanks!

 

Hi @e0318476 ,

 

The question here is context since you are not using the full name that is not part of the measures you are using for the line chart you don't get the result you need.

 

You need to add the data context to your calculation. Add the following measure:

 

Count rows =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            'Table',
            'Table'[Full Name],
            'Table'[Completion Date],
            'Table'[Registration Date]
        ),
        'Table'[Completion Date]
            IN VALUES ( 'calendar'[Date] )
                || 'calendar'[Completion] IN VALUES ( 'calendar'[Date] )
    )
)

MFelix_0-1635153064343.png

Top char the same has yours, bottom chart with trhe measure above.

 

 


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
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.