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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.