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.
Hi Good people,
I am struggling a bit with the dashboard as below :
What I want to achieve is as follows :
When I choose the date from the date slicer (this is a disconnected table), it should return me the two pies and the two tables below that - one each for the current month and the previous month.
I am achieving the display for the current and M-1 graph and table by using a flag (whch goes as a filter on the visual) as below :
Flag_previous =
var _Selectmonth = MONTH(SELECTEDVALUE('Date slicer'[Date]))
return
if (MONTH(MAX('Amazon YTD'[Purchase Date]))=_Selectmonth-1,1,0)
While the flag currently displays the months, for the previous month, the data shown is for the full month and not till the day chosen from the date slicer.
Can this be fixed, by modifying the MTD-1 measure I am using, whereby it computed MTD only till the day chosen :
MTD Val =
TOTALMTD('Measures tray'[Total Sales],'Date Table'[Date])
Thanks
Solved! Go to Solution.
@monojchakrab , try like
MTD =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1)+1 ,
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
LMTD =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _max = date(Year(_max1), month(_max1)-1, day(_max))
var _min = eomonth(_max1,-2)+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_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)
var _max = date(year(today()),month(today())-1,day(today())-1)
var _min = eomonth(_max,-1)+1
return
CALCULATE(sum['amazon',[purchase date] ,DATESBETWEEN('calendar'[Date],_min,_max))
Hii @monojchakrab
please use this dax, I re-write this code from @amitchandak
var _max = date(year(today()),month(today())-1,day(today())-1)
var _min = eomonth(_max,-1)+1
return
CALCULATE(sum['amazon',[purchase date] ,DATESBETWEEN('calendar'[Date],_min,_max))
Hii @monojchakrab
please use this dax, I re-write this code from @amitchandak
@monojchakrab , try like
MTD =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1)+1 ,
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
LMTD =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _max = date(Year(_max1), month(_max1)-1, day(_max))
var _min = eomonth(_max1,-2)+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_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 |
---|---|
113 | |
100 | |
77 | |
76 | |
52 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |