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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.