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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
sabariprabu
Frequent Visitor

Measure based on only Date Filter Condition

Hi, 

 

I have the below table data. Price amount is stored based on Year-Month and Type (Actual/Budget).

 

Year- Month field is having a relationship with Data Table. There are date, month and year slicers available in Power BI from Data Table.

 

Year - MonthTypePrice
2022 - 01Actual450
2022 - 01Budget500
2022 - 02Actual300
2022 - 02Budget250
2022 - 03Budget400
2022 - 04Budget500
2022 - 05Budget600
2022 - 06Budget200
2022 - 07Budget300

 

I need to create two measures "Actual Price" (Type = Actual) and "Budget Price" (Type = Budget).

These two measures should change only based on the Date filters and any other filters should not affect these values at any case.

 

If multiple year and months are selected then meaures should show the average value since multiple prices will be as result.

 

Please help with DAX.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@sabariprabu ,These measures should help 

 

Actual= AverageX(Values(Table[Month Year]) , Calculate(Sum(Table[price]), filter(Table, Table[Type] = "Actual")) )

 

 

 

Budget= AverageX(Values(Table[Month Year]) ,  Calculate(Sum(Table[price]), filter(Table, Table[Type] = "Budget")) )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@sabariprabu ,These measures should help 

 

Actual= AverageX(Values(Table[Month Year]) , Calculate(Sum(Table[price]), filter(Table, Table[Type] = "Actual")) )

 

 

 

Budget= AverageX(Values(Table[Month Year]) ,  Calculate(Sum(Table[price]), filter(Table, Table[Type] = "Budget")) )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.