Forum Discussion

Nurzh's avatar
Nurzh
Frequent Visitor
3 years ago
Solved

Line and Clustered Column Chart, custom line

Hi all, 

I am trying to create Line and Clustered Column Chart, with custom lines

Shortcut of dataset is below:  

Is_reviewedDoc_numberForecast DatesPeriod Type
True61-BDIN-52001June 2023Actual
False61-BFIN-21012June 2023Forecast
True61-HS-51762-3June 2023Actual
True61-NAS-52083June 2023Actual
False61-NFI-52007June 2023Forecast
False61-NGC-52010-1June 2023Forecast
False61-NGC-52071June 2023Forecast
False61-NGT-52060June 2023Forecast

 

The goal is to create custom line that shows: 

1. Actual rundown: Sum of all Doc_numbers and minus only count of Doc_numbers with Is_reviewed = True  (dataset will be updated to true if someone will review this doc number) and Period Type=Actual

2. Forecast rundown: Sum of all Doc_numbers and minus count of Doc_numbers with  Is_reviewed = False and Period Type=Forecast

The correct version of chart was in Excel below, and I am trying create in Power BI: 

 

 

Please help to create measures for this 2 additional lines. 

 

Many thanks! 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Nurzh ,

     

    Create another measure and place it on the [line y-axis].

     

    Measure = IF(SELECTEDVALUE('Table'[Period Type])="Actual",[Actual rundown],[Forecast rundown])

     

    Change the style of the line under the [format your visual] pane.

     

    Best Regards,

    Neeko Tang

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

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Nurzh ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create measures. 

     

    Actual rundown = 
    var _a=COUNTROWS(VALUES('Table'[Doc_number]))
    var _b=COUNTROWS(FILTER(ALLSELECTED('Table'),'Table'[Is_reviewed]=TRUE() && 'Table'[Period Type]="Actual"))
    return _a-_b
    Forecast rundown = 
    var _a=COUNTROWS(VALUES('Table'[Doc_number]))
    var _b=COUNTROWS(FILTER(ALLSELECTED('Table'),'Table'[Is_reviewed]=FALSE() && 'Table'[Period Type]="Forecast"))
    return _a-_b

     

    (3) Then the result is as follows.

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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

    • Nurzh's avatar
      Nurzh
      Frequent Visitor

      Hi Anonymous , 

      Thanks for sharing, 

      Could you please also advise why the line not presented as desired result that I have attached previously, it's devided into 2 lines. 

       

      I need to show one single line, for actual and forecast rundown. In my source file totally I have 133 doc number, and their status gradually will be changed to actual from forecast. For example this total 133 doc numbers will run down with changing of their status is_reviewed = true. 

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Nurzh ,

         

        Create another measure and place it on the [line y-axis].

         

        Measure = IF(SELECTEDVALUE('Table'[Period Type])="Actual",[Actual rundown],[Forecast rundown])

         

        Change the style of the line under the [format your visual] pane.

         

        Best Regards,

        Neeko Tang

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