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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
untapjoseph
Helper I
Helper I

Calculated groups DAX error

Hello - can anyone tell me why this DAX is not working when i use to try and create a calculation group...? Thanks in advance!

 

VAR date =
MAX ( BO_data[Reference_Date] )
VAR LastDec =
DATE ( YEAR ( ( date ) - 1 ), MONTH ( 12 ), DAY ( date ) )
VAR RESULT =
CALCULATE (
SELECTEDMEASURE (),
FILTER ( 'Calendar', 'Calendar'[Date] <= LastDec )
)
RETURN
RESULT

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@untapjoseph , try like

 

VAR _date =
MAXX (allselcted( BO_data), BO_data[Reference_Date] )
VAR LastDec = DATE ( YEAR ( ( _date ) - 1 ), 12 , DAY ( _date ) )
VAR RESULT =
CALCULATE (
SELECTEDMEASURE (),
FILTER (all( 'Calendar'), 'Calendar'[Date] <= LastDec )
)
RETURN
RESULT

 

if needed remove all from calendar

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@untapjoseph , try like

 

VAR _date =
MAXX (allselcted( BO_data), BO_data[Reference_Date] )
VAR LastDec = DATE ( YEAR ( ( _date ) - 1 ), 12 , DAY ( _date ) )
VAR RESULT =
CALCULATE (
SELECTEDMEASURE (),
FILTER (all( 'Calendar'), 'Calendar'[Date] <= LastDec )
)
RETURN
RESULT

 

if needed remove all from calendar

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors