Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
I can do this easily using the the filter, but I really want to do it using DAX.
I've tried multiple "lastdate" variations but i'm not sure the syntext to move it back 7 or 14 days.
I have a the below table and i simply want a DAX that counts the number of devices that last log on in the past 7 days. i'll replacate that formular to then account for the last 14 days.
Device Name | Last Logon Date | Confidence Level |
AAA | Jan 29 | Medium |
BBB | Jan 3 | High |
CC | April 21 | Medium |
Solved! Go to Solution.
Hi @sharpedogs
try
Measure = CALCULATE(COUNTROWS('Table');'Table'[Last Logon Date]>=today()-7)
do not hesitate to give a kudo to useful posts and mark solutions as solution
try
Measure = CALCULATE(COUNTROWS('Table');'Table'[Last Logon Date]>=today()-14;'Table'[Last Logon Date]<=today()-7)
do not hesitate to give a kudo to useful posts and mark solutions as solution
Hi @sharpedogs
try
Measure = CALCULATE(COUNTROWS('Table');'Table'[Last Logon Date]>=today()-7)
do not hesitate to give a kudo to useful posts and mark solutions as solution
Hi, wondering if i can piggyback on my ask 🙂
Instead of the last 7 days... what if i now wanted a range say between 7 and 14 days? I'm not sure what i do with the TODAY () function so that is starts at 7 days?
try
Measure = CALCULATE(COUNTROWS('Table');'Table'[Last Logon Date]>=today()-14;'Table'[Last Logon Date]<=today()-7)
do not hesitate to give a kudo to useful posts and mark solutions as solution
Why is it so simply when you provide the answer....lol
Thanks
it's a practice question.
good luck and welcome to power bi! 🙂
Tried.... and worked perfectly!!!