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.
I am stuck in a situation.
I have a revenue table connected to the calendar table by a date column.
On the report page, I shouldn't have a date slicer.
I need to create a line chart, showing two lines, line1 cumulative sum for this month (i.e. from 01.02 to 16.02) and line2 shows cumulative sum for the same period last month ( i.e. 01.01 to 16.01). The x-axis should be Month-day-number (means from 1 to 31).
I made the cumulative sum as follow:
can anybody help me?
all the cumulative measures are with ALLSELECTED() function, or with MAX(DATE) , and they all work fine with a date filter (slicer).
Solved! Go to Solution.
@Anonymous , if you are using date from a date in visual you do not need a slicer, it should work
you can try like
MTD QTY forced=
var _max = today()
return
if(max('Date'[Date])<=_max, calculate(Sum('order'[Qty]),DATESMTD('Date'[Date])), blank())
//or
//calculate(Sum('order'[Qty]),DATESMTD('Date'[Date]),filter('Date','Date'[Date]<=_max))
//calculate(TOTALMTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<=_max))
LMTD QTY forced=
var _max = date(year(today()),month(today())-1,day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALMTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)
@Anonymous , with help from date table-use datesmtd
Revenue
MTD Sales = CALCULATE(SUM(Revenue[Revenue]),DATESMTD('Date'[Date]))
Thank you or your answer.
DATESMTD() works fine when there is a date filet on the page or on the visual.
I need a formula which works without a date slicer.
and the second point is that, with DATESMTD(), we can not have a cumulative sum from first day of last month to today's day at last month (today is 17.02, so to 17.01)
@Anonymous , if you are using date from a date in visual you do not need a slicer, it should work
you can try like
MTD QTY forced=
var _max = today()
return
if(max('Date'[Date])<=_max, calculate(Sum('order'[Qty]),DATESMTD('Date'[Date])), blank())
//or
//calculate(Sum('order'[Qty]),DATESMTD('Date'[Date]),filter('Date','Date'[Date]<=_max))
//calculate(TOTALMTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<=_max))
LMTD QTY forced=
var _max = date(year(today()),month(today())-1,day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALMTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |