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
poojag820
Helper I
Helper I

Show data in table greater than selected month against selected month in DAX

My requirement is to show sum of sales for date greater than selected date againsed selected Date only. 

I am using below dax which is working fine for single selection and total is also coming fine, 

Sales =
var Selected_Date = SELECTEDVALUE('table'[Period])
VAR _Sales =
    CALCULATE(
        SUMX(Sales,Sales[Sales]),
        'table'[Period] > Selected_Date
  )
RETURN
_Sales
 
But as soon as I select multiple periods my individual values are coming correct but Total is not coming right. I know SELECTEDVALUE works with only single selection but I can not come up with any solution for multiple selection. Any help is appreciatedl. 
 
1 ACCEPTED SOLUTION

@poojag820 , Try this

 

dax
Sales =
VAR Selected_Dates = VALUES('table'[Period])
VAR Sales_Sum =
SUMX(
Selected_Dates,
CALCULATE(
SUM(Sales[Sales]),
'table'[Period] > EARLIER('table'[Period])
)
)
RETURN
Sales_Sum




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

7 REPLIES 7
bhanu_gautam
Super User
Super User

 

@poojag820 , Try this replace max with MAXX

 

Sales =
VAR Selected_Dates = VALUES('table'[Period])
VAR _Sales =
CALCULATE(
SUMX(Sales, Sales[Sales]),
'table'[Period] > MAXX(Selected_Dates, 'table'[Period])
)
RETURN
_Sales




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






unfortunately total is still not coming correct. Individual value is coming correct

 

 

@poojag820 , Try this

 

dax
Sales =
VAR Selected_Dates = VALUES('table'[Period])
VAR Sales_Sum =
SUMX(
Selected_Dates,
CALCULATE(
SUM(Sales[Sales]),
'table'[Period] > EARLIER('table'[Period])
)
)
RETURN
Sales_Sum




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi @bhanu_gautam 
I am facing one challlenge, When I am this calculated measure along with Dates col which includes month one greater than current month or one month prior, its not giving current month but all month corresponding to that instance. 

For eg when I dont add the above measure then my date col is showing correct date as below 

poojag820_0-1725275745120.png

but as soon as I add calculated measure with above dax my date col start showing multiple month for one start month 

poojag820_2-1725276034276.png

 

I also used removefilters to nullify the effect of this col in measure but its not working 

Worked! thanks alot for the instant help. appreciate it!

bhanu_gautam
Super User
Super User

@poojag820 , Try below DAX

 

dax
Sales =
VAR Selected_Dates = VALUES('table'[Period])
VAR _Sales =
CALCULATE(
SUMX(Sales, Sales[Sales]),
'table'[Period] > MAX(Selected_Dates)
)
RETURN
_Sales




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Max is not working with variable created. getting error "The MAX function only accepts a column reference as an argument."

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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