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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Rami_Aziz
Helper I
Helper I

count current \ previous year based on date from another table(not calendar) dax

Hi Everyone, 

kindly you help, im trying to get the count from Table1 fot current year and Previous year based on a column date from different table 2, so i need to get the count on two cards 1.current year , 2. previous year 

 

the two table got a relationship field , i tried previousyear & dateadd but didnt work 

 

i could get current year but not sure about it 

 

 current year = CALCULATE(COUNT(msdyn_workorder[Service Account]),DATESYTD(bookableresourcebooking[Start Time]))

 

Count WO from Table 1 

Rami_Aziz_0-1676890212821.png

 Date from table 2 

Rami_Aziz_1-1676890302212.png

thank you 

2 REPLIES 2
Rami_Aziz
Helper I
Helper I

I dont think this is it. if i choose the sclicer for 2023 

Rami_Aziz_0-1676891755799.png

and if i choose the slicer for 2022 its giving me 302 which supposed to be 

Rami_Aziz_1-1676891879271.png

 

FreemanZ
Super User
Super User

hi @Rami_Aziz 

try like:

last year = 
CALCULATE(
    COUNT(msdyn_workorder[Service Account]),
     SAMEPERIODLASTYEAR(DATESYTD(bookableresourcebooking[Start Time]))
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.