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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
John-Michael
Frequent Visitor

Use Measure to return multiple values for a line graph

I have this measure below which returns a value based on slicers. It works well and currently returns 'All Projections'[FORECAST] to be on a line graph. Is there any way I can change this measure so that it can return TWO values to make two lines? In addition to [FORCAST] I also have [COUNTS] as a separate column in the same table.

 

Thanks!

 
counts_forecast =
      VAR sitecount =
              CALCULATE (
                         DISTINCTCOUNT ( 'All Projections Bridge'[site number] ),
                         ALLSELECTED ( 'All Projections Bridge' ),
                         ALLSELECTED ( 'All Projections Legend' )
    )
VAR proccount =
         CALCULATE (
                   DISTINCTCOUNT ( 'All Projections Bridge'[procedure number] ),
                   ALLSELECTED ( 'All Projections Bridge' ),
                   ALLSELECTED ( 'All Projections Legend' )
    )
VAR levelnum =
         SWITCH ( TRUE ()sitecount = 13proccount = 121 )
RETURN
         CALCULATE (
                    SUM ( 'All Projections'[FORECAST] ),
                    'All Projections Legend'[Level] = levelnum
    )
3 REPLIES 3
v-rongtiep-msft
Community Support
Community Support

Hi @John-Michael ,

Please refer to the following topics.

https://community.powerbi.com/t5/Desktop/How-to-create-two-lines-in-a-line-chart/td-p/135098

https://community.powerbi.com/t5/Desktop/Display-2-lines-for-different-years-in-a-line-chart/td-p/17...

 

If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards

Community Support Team _ Polly

 

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

Syk
Super User
Super User

A single measure won't be able to give you 2 different lines. But, you can create a new measure to look specifically at counts and add that to your chart!

I would do this, however; when you use two measures in the "values" section of the line graph, you can no longer have anything in the legend. The purpose of this measure is to use a dynamic legend/graph so that is not an option for me unfortunately.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.