Forum Discussion
vivek_babu
Helper II
1 year agoCountrows not working properly
Hi, I am trying to count the rows based on the year and month column selected in the slicer. When a user selects Year = 2022 and Month = Jan then i need to count the rows for the previous month. ...
- 1 year ago
Hi All,
The issue was with the filter function inside the calculate function. I removed the filter and directly applied the condition and it worked. Thanks for your help!
Prev_Sales =Var r_year = SELECTEDVALUE('Table'[Year])var r_month = SELECTEDVALUE('Table'[Reporting Month Number])VAR prev_month = IF(r_month = 1, 12, r_month - 1)VAR prev_year = IF(r_month = 1, r_year - 1, r_year)RETURNCALCULATE(SUM('Table'[Sales]),'Table'[Year] = prev_year && 'Table'[Reporting Month Number] = prev_month)RegardsVivek N
vivek_babu
Helper II
1 year agoHi Bibiano_Geraldo shafiz_p Kedar_Pande
Thanks for providing your solutions. Unfortunately, all the solution is giving me blank values. In all of three solutions the previous year and previous month value is coming correctly but when we countrows of the table by filtering the table's year and month with our previous year and previous month values is not working. Not sure why it is not filtering the data properly
@Jai-Rathinavel @lbendlin @DataNinja777 @FreemanZ @Greg_Deckler @shafiz_p @Ritaf1983 @Kedar_Pande @v-jialongy-msft @v-xianjtan-msft @vojtechsima
Regards
Vivek N