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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register 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")) )

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")) )

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.