Forum Discussion
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)
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]) ))
3 Replies
- amitchandak
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])
- AnonymousNot 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])- amitchandak
Super User
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]) ))