Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I'm currently working on a report that has a visual of new contracts that are downloaded to a CSV file automatically updating every monday. I would like it show new contracts that have been added over the last week or 14 days maybe even the last month.
Is there a way to do this, I'm still new to PowerBi but I'm picking stuff up as I go along.
Thanks in advance.
Solved! Go to Solution.
Hi @GH21 ,
I created some data:
Here are the steps you can follow:
1. Enter data – create a table.
2. Create measure.
Flag =
var _select=SELECTEDVALUE('Table2'[Slicer])
var _today=TODAY()
return
SWITCH(
TRUE(),
_select ="last week"&&MAX('Table'[Date]) >DATE(YEAR(_today),MONTH(_today),DAY(_today)-7)&&MAX('Table'[Date]) <=_today,1,
_select ="14 days" &&MAX('Table'[Date])>DATE(YEAR(_today),MONTH(_today),DAY(_today)-14)&&MAX('Table'[Date]) <=_today,1,
_select ="last month"&&MAX('Table'[Date])>EOMONTH(_today,-2)&&MAX('Table'[Date]) <=EOMONTH(_today,-1),1,0)
3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
Related functions:
SWITCH function (DAX) - DAX | Microsoft Learn
SELECTEDVALUE function - DAX | Microsoft Learn
TODAY function (DAX) - DAX | Microsoft Learn
DATE function (DAX) - DAX | Microsoft Learn
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @GH21 ,
I created some data:
Here are the steps you can follow:
1. Enter data – create a table.
2. Create measure.
Flag =
var _select=SELECTEDVALUE('Table2'[Slicer])
var _today=TODAY()
return
SWITCH(
TRUE(),
_select ="last week"&&MAX('Table'[Date]) >DATE(YEAR(_today),MONTH(_today),DAY(_today)-7)&&MAX('Table'[Date]) <=_today,1,
_select ="14 days" &&MAX('Table'[Date])>DATE(YEAR(_today),MONTH(_today),DAY(_today)-14)&&MAX('Table'[Date]) <=_today,1,
_select ="last month"&&MAX('Table'[Date])>EOMONTH(_today,-2)&&MAX('Table'[Date]) <=EOMONTH(_today,-1),1,0)
3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
Related functions:
SWITCH function (DAX) - DAX | Microsoft Learn
SELECTEDVALUE function - DAX | Microsoft Learn
TODAY function (DAX) - DAX | Microsoft Learn
DATE function (DAX) - DAX | Microsoft Learn
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@GH21 , refer if this solution can help
a measure like
Last 7 days =
var _max = maxx(allselected(Date),Date1[Date])
var _min = _max -7
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))
Hi @amitchandak, thank you for this however i'm struggling to understand the logic for it.
User | Count |
---|---|
93 | |
83 | |
77 | |
72 | |
66 |
User | Count |
---|---|
115 | |
103 | |
93 | |
64 | |
61 |