Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

when get same period of last year, if the date is not applicable, how to make it blank

i tried to get the number of rows from the same period of last year, and use this measure:

 

target = CALCULATE(COUNTROWS('leads final'), datesbetween('leads final'[modifiedon (bins)], FIRSTDATE(DATEADD('leads final'[modifiedon (bins)], -12, MONTH)),LASTDATE(DATEADD('leads final'[modifiedon (bins)], -12, MONTH))))
 
i know that lastDate and FirstDate will return the most latest/earliest date when the formula is not applicable. i do not want that happen, just showing blank. 
 
can anyone please help me out?
 
thank you 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Yes, you would want to create a date table and relate that to your main table. You can create a calendar easily using CALENDARAUTO() or the CALENDAR functions when creating a caclulated table. 

 

https://docs.microsoft.com/en-us/dax/calendar-function-dax

 

Then from there you want to be sure to mark that as date table:

How to Mark as Date Table.png

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Datesbetween is a time-intelligence function, and as such requires a dedicated date table to work correctly. Do you have a data table?

Anonymous
Not applicable

Nope. all the fields are from the same table. Do i have to create another data table to connect with my original table?

 

thanks

Anonymous
Not applicable

Yes, you would want to create a date table and relate that to your main table. You can create a calendar easily using CALENDARAUTO() or the CALENDAR functions when creating a caclulated table. 

 

https://docs.microsoft.com/en-us/dax/calendar-function-dax

 

Then from there you want to be sure to mark that as date table:

How to Mark as Date Table.png

Anonymous
Not applicable

thanks! i saw this kind of method somewhere when we create KPI. may i ask why we need this date table?

 

thanks

Hi,

With a Calendar Table in place, you will be able to use the Date and Time Intellignece functions of DAX with ease.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.