The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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,
Solved! Go to 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
Proud to be a 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
Proud to be a Super User! |
|
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
Proud to be a Super User! |
|
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
but as soon as I add calculated measure with above dax my date col start showing multiple month for one start month
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!
@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
Proud to be a Super User! |
|
Max is not working with variable created. getting error "The MAX function only accepts a column reference as an argument."