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
shoaib944
New Member

The DAX formula is not working when year is filtered by calender table

The DAX formula is not working properly when year is filtered by calender table.

Revenue_2010 = CALCULATE(SUMX('Online Retail','Online Retail'[Quantity]*'Online Retail'[UnitPrice]),
FILTER(ALL('Online Retail'),YEAR('Online Retail'[InvoiceDate])=2010)) --- working correctly
 
Revenue_2010 = CALCULATE(SUMX('Online Retail','Online Retail'[Quantity]*'Online Retail'[UnitPrice]),
FILTER(ALL('Calendar'),YEAR('Calendar'[Date])=2010)) --- not working
 
Can somebody please help me in understanding this?
1 REPLY 1
ppm1
Solution Sage
Solution Sage

FYI that it is better practice (and more performant) to add a Year column to your Calendar table and use a measure expression like this. Also, please confirm that you have a 1:M relationship between the tables, and that you are not using the 'Calendar'[Date] column in the visual already (you can but a different expression likely needed).

 

Revenue_2010 =
CALCULATE (
    SUMX ( 'Online Retail', 'Online Retail'[Quantity] * 'Online Retail'[UnitPrice] ),
    'Calendar'[Year] = 2010
)

 

Pat

Microsoft Employee

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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