Forum Discussion
create trend line from maximum to zero line chart
- 7 years ago
Hi sureshpydi. Try this out:
Trend Points = VAR __MinDate = MINX ( ALL ( Sheet1 ), Sheet1[Date] ) VAR __MinValue = LOOKUPVALUE ( Sheet1[Value], Sheet1[Date], __MinDate ) VAR __MaxDate = MAXX ( ALL ( Sheet1 ), Sheet1[Date] ) VAR __MaxValue = LOOKUPVALUE ( Sheet1[Value], Sheet1[Date], __MaxDate ) RETURN IF ( CALCULATE ( MIN ( Sheet1[Date] ) ) = __MinDate, __MinValue, IF ( CALCULATE ( MAX ( Sheet1[Date] ) ) = __MaxDate, __MaxValue, BLANK () ) )You'll have to be sure to set the X-axis as "Continuous" instead of "Categorical" or you will only get the starting and ending points. Also, depending on your actual data set, the "ALL" function might have to be tweaked (using KEEPFILTERS or the like).
Hope this helps,
David
HI sureshpydi,
Nope, you can't manually control analyse trend line, it is managed by power bi itself and generated based on data trend.(it not contains options allow you to customize on it)
Using the Analytics pane in Power BI Desktop
Regards,
Xiaoxin Sheng
Hi Xiaoxin Sheng,
Thanks for the reply. I have tried this. But it was not worked for me. I need a line from Max to 0 using DAX query. Could you please let me know if it is possible with DAX?
Thanks,
Suresh
- dedelman_clng7 years ago
Community Champion
Hi sureshpydi. Try this out:
Trend Points = VAR __MinDate = MINX ( ALL ( Sheet1 ), Sheet1[Date] ) VAR __MinValue = LOOKUPVALUE ( Sheet1[Value], Sheet1[Date], __MinDate ) VAR __MaxDate = MAXX ( ALL ( Sheet1 ), Sheet1[Date] ) VAR __MaxValue = LOOKUPVALUE ( Sheet1[Value], Sheet1[Date], __MaxDate ) RETURN IF ( CALCULATE ( MIN ( Sheet1[Date] ) ) = __MinDate, __MinValue, IF ( CALCULATE ( MAX ( Sheet1[Date] ) ) = __MaxDate, __MaxValue, BLANK () ) )You'll have to be sure to set the X-axis as "Continuous" instead of "Categorical" or you will only get the starting and ending points. Also, depending on your actual data set, the "ALL" function might have to be tweaked (using KEEPFILTERS or the like).
Hope this helps,
David