Forum Discussion

TomaKavi's avatar
TomaKavi
Icon for Helper I rankHelper I
3 years ago
Solved

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 

 

but I  need this 

 

  • 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 () )
        )

3 Replies

  • 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

    • TomaKavi's avatar
      TomaKavi
      Icon for Helper I rankHelper I

      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 

       

  • 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 () )
        )