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
TomaKavi
Helper I
Helper I

how to create a linear line in line chart

Hello everyone,

 

I have built a cumulative line in line visual and I want to create a linear line that will show 0  at the start and max Value at the end of the visual. Any tips ? I literally need the black line to be built. I am using dax so all measures are explicit but I cant figure out how to make this basic line :D. 

 

I have tried this

Linear line =
var minvalue = 0
var maxvalue = [Nr. WO]
var startdate = [FirstDateWP]
var maxdate = [LastDateWP]

return
IF(CALCULATE( MIN(DateTable[Date])) <= startdate,0, IF(CALCULATE(MAX(DateTable[Date])) <= maxdate,maxvalue, BLANK()))

this is the result 

TomaKavi_1-1674038311002.png

 

but I  need this 

TomaKavi_0-1674038148906.png

 

1 ACCEPTED SOLUTION
TomaKavi
Helper I
Helper I

I have already sorted it out. It was a need to remove a date filter only (for Trend WO number). everything else works just fine

Linear Line Plan =
VAR __MinDate =
    [FirstDateWP]
VAR __MinValue = 0
   
VAR __MaxDate =
    [LastDateWP]
VAR __MaxValue =[Trend WO number]

RETURN

IF (
        CALCULATE ( MIN ( DateTable[Date] ) ) = __MinDate,
        __MinValue,
        IF ( CALCULATE ( MAX ( DateTable[Date] ) ) = __MaxDate, __MaxValue, BLANK () )
    )

View solution in original post

3 REPLIES 3
TomaKavi
Helper I
Helper I

I have already sorted it out. It was a need to remove a date filter only (for Trend WO number). everything else works just fine

Linear Line Plan =
VAR __MinDate =
    [FirstDateWP]
VAR __MinValue = 0
   
VAR __MaxDate =
    [LastDateWP]
VAR __MaxValue =[Trend WO number]

RETURN

IF (
        CALCULATE ( MIN ( DateTable[Date] ) ) = __MinDate,
        __MinValue,
        IF ( CALCULATE ( MAX ( DateTable[Date] ) ) = __MaxDate, __MaxValue, BLANK () )
    )
amitchandak
Super User
Super User

@TomaKavi , You can try window for cumulative function or with help from date table

 

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[date] <=max('Date'[date])))

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[Date])))

 

Running Total/ Cumulative: https://www.youtube.com/watch?v=h2wsO332LUo&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=41

 

Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc

my problem is this measure, if I hardcode this value lets say on 1290 it works perfectly fine. So I need to remove all filters but keep the one used  on plane 

TomaKavi_0-1674049218374.png

TomaKavi_1-1674049239133.png

 

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.

Top Solution Authors