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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

how do i convert SUMIF function to powerbi formula?

 

I'm new to DAX and struggling with a formula, I am trying to replicate the following excel formula in PowerBi.

 

In my scenario I have, sales value(F Net value CR), year(2019-2020, 2020-2021, 2021-2022)

i want calculate total sales by year(display year)

 

vs_7_0-1644900874702.png

 

1 ACCEPTED SOLUTION

@Anonymous , Try like


total sales = calculate(sum(Sales[N F Net Value Cr]),filter(allselected(Master_Calendar),Master_Calendar[Display Year] = max(Master_Calendar[Display Year]) ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , New measure

sumx(filter(allselected(Table), Table[Display Year] = max(Table[Display Year]) ), Table[F Net value CR])

 

add other, if need like channel

sumx(filter(allselected(Table), Table[Display Year] = max(Table[Display Year]) && Table[channel] = max(Table[channel]) ), Table[F Net value CR])

 

 

if you need column

sumx(filter((Table), Table[Display Year] = earlier(Table[Display Year]) ), Table[F Net value CR])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

actuall i have two tables sales and calender, sales data fetching from S4HANA 

i tried your messure but below error is showing.

 

total sales = sumx(filter(allselected(Master_Calendar,Master_Calendar[Display Year] = max(Master_Calendar[Display Year]) ), Sales[N F Net Value Cr])

vs_7_0-1644905754108.png

 

 

@Anonymous , Try like


total sales = calculate(sum(Sales[N F Net Value Cr]),filter(allselected(Master_Calendar),Master_Calendar[Display Year] = max(Master_Calendar[Display Year]) ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors