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.
In a simple table I have Dates in one column and Names in the second one. I need to calculate number of visits in the next 2 weeks from the max date in the filter context. Any help?
Thanks in advance
Solved! Go to Solution.
This seems to resolve:
Next2Wks = var max_Date = CALCULATE(MAX('Calendar'[Date]);ALLSELECTED('Calendar'[Date])) RETURN CALCULATE(COUNTA(tVisitas[Nome]);FILTER(all('Calendar');'Calendar'[Date]>=max_Date&&'Calendar'[Date]<=max_Date+16))
Thank you
Hi @Fcoatis,
The filter context is a slicer, right? If it is, you need to create a measure to get the max date of the slicer. Please use the formula below.
max_date=CALCULATED(MAX(filtertable[date]),ALLSELECTED(filtertable[date]))
Then create a measure using the formula.
the number of visits=CALCULATE(COUNTA(Table[name]),FILTER(Table,Table[Date]>=[max_date]&&Table[Date]<=DATEADD([max_date],14,day))
Best Regards,
Angelia
Thank you for the help,
But the expression <=DATEADD([max_date],14,day) wasnt accepetd.
Heres my pbix example https://www.dropbox.com/s/er7vviseqjbsv46/visitas.pbix?dl=0
Fabio
This seems to resolve:
Next2Wks = var max_Date = CALCULATE(MAX('Calendar'[Date]);ALLSELECTED('Calendar'[Date])) RETURN CALCULATE(COUNTA(tVisitas[Nome]);FILTER(all('Calendar');'Calendar'[Date]>=max_Date&&'Calendar'[Date]<=max_Date+16))
Thank you
Hi @Fcoatis,
Congratulations, you have resolved your issue by yourself. Please mark your workaround as answer, so more people will benefit from here.
Best Regards,
Angelia
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 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |