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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply

Add linear line on on chart from right to left

Morning all

 

I have posted this question i the past and it was solved but for some reason it has now stopped working and I can't (for the life of me) figure out how to fix it. Below is the link to my original question

Solved: Add a Linear line from top left to bottom right in... - Microsoft Fabric Community

 

I'm using the following Dax statement

IF (
    MAX ( 'Views Change Requests'[closed_at_value].[Date]) = MAXX ( ALLSELECTED( 'Views Change Requests'[closed_at_value].[Date]), 'Views Change Requests'[closed_at_value].[Date])
        || MIN ( 'Views Change Requests'[closed_at_value].[Date]) = MINX ( ALLSELECTED(  'Views Change Requests'[closed_at_value].[Date]), 'Views Change Requests'[closed_at_value].[Date]),
   COUNT('Views Change Requests'[number_value]))
 
And adding in a secondary line that relates to the above formula. Based on previously working I would expect it to work but no, all I am now getting it the below - as you can see the # Max Min line 2 is not appearing
KarenFingerhut_0-1712571633284.png

What I would like to see is something like the below

KarenFingerhut_1-1712571668703.png

Can someone please help me 😊

 

Thank you

 

Many thanks

Karen

1 ACCEPTED SOLUTION
v-zhengdxu-msft
Community Support
Community Support

Hi @KarenFingerhut 

 

Thanks for the reply from @DataNinja777 ,please allow me to provide another insight:

Maybe you can try this:

IF (
    MAX ( 'Views Change Requests'[closed_at_value] )
        = MAXX (
            ALLSELECTED ( 'Views Change Requests' ),
            'Views Change Requests'[closed_at_value]
        )
        || MIN ( 'Views Change Requests'[closed_at_value] )
            = MINX (
                ALLSELECTED ( 'Views Change Requests' ),
                'Views Change Requests'[closed_at_value]
            ),
    COUNT ( 'Views Change Requests'[number_value] )
)

 

If the above one can't help you, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-zhengdxu-msft
Community Support
Community Support

Hi @KarenFingerhut 

 

Thanks for the reply from @DataNinja777 ,please allow me to provide another insight:

Maybe you can try this:

IF (
    MAX ( 'Views Change Requests'[closed_at_value] )
        = MAXX (
            ALLSELECTED ( 'Views Change Requests' ),
            'Views Change Requests'[closed_at_value]
        )
        || MIN ( 'Views Change Requests'[closed_at_value] )
            = MINX (
                ALLSELECTED ( 'Views Change Requests' ),
                'Views Change Requests'[closed_at_value]
            ),
    COUNT ( 'Views Change Requests'[number_value] )
)

 

If the above one can't help you, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-zhengdxu-msft 

Apologies for late reply

I think it's worked :). I'll do a bit more testing and get my head around the DAX statement. You're a  Thanks so much.

Kind regards

Karen

Thank you @DataNinja777 . Yes thats what im trying to do . However I can't get it to work when the x axis is a date range. Ill keep trying 🙂

Thanks Karen

DataNinja777
Super User
Super User

Hi @KarenFingerhut 

Are you trying to add a linear regression line?  In that case, have you read the article below explains how to do it using dax functions?   

https://www.sqlbi.com/articles/implementing-linear-regression-in-power-bi/

Best regards,

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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