Forum Discussion
SUMIF Function
Hi,
I am struggling to covert my SUMIF Excel formula to DAX,
This is my excel formula:
=SUMIFS('Slave Data'!$E:$E,'Slave Data'!K:K,"=1",'Slave Data'!$B:$B,"="&$B10,'Slave Data'!L:L,"="&H1)
This is the sample data from excel
Within BI i have the same columns and would like to create a measure to equal the output of the excel formula,
How can i create a formua with multiple conditions?
- Anonymous9 years ago
Sum of Duration = CALCULATE( SUM(SlaveData[duration]), FILTER( SlaveData, SlaveData[If Status Met] = 1 && SlaveData[slaveid] = 1 && Slavedata[datStart] = TODAY() ) )
19 Replies
- SeanCommunity Champion
It seems you want the user to enter the values in individual cells - H1 and B10?
You can't do this in PBI.
But you can get all results for your data set basically by using this formula
Measure = CALCULATE ( SUM ( Table[E] ), Table[K] = 1, ALLEXCEPT ( Table, Table[B], Table[L] ) )This will give you the sum in column E for all combinations of columns B & L where K is 1
Then create a Table visualization
Add Columns B and L (make sure you select Do Not Summarize for Both) and then add the Measure
Hope this helps!
- Greg_DecklerCommunity Champion
I'm not super familiar with Excel's SUMIFS statement so you'd have to explain what your formula is doing. But, you *should* be able to replace it with a DAX equivalent, even if it just a bunch of IF statements.
- itchyeyeballsImpactful Individual
have a look at this
http://www.powerpivotpro.com/2009/12/powerpivot-dax-calculate-is-a-supercharged-sumif/
and
http://www.powerpivotpro.com/2014/10/sum-sumx-or-calculatechoices-choices/
will be a good starting point
- chrisread9907Frequent Visitor
Thanks, So the written formula would be
SUM of SlaveData[duration] if Slavedata[If Status Met] =1 and if Slavedata[slaveid] =1 and if Slavedata[datStart] = today
Sorry for not explianing properly,
Chris
- AnonymousNot applicable
Sum of Duration = CALCULATE( SUM(SlaveData[duration]), FILTER( SlaveData, SlaveData[If Status Met] = 1 && SlaveData[slaveid] = 1 && Slavedata[datStart] = TODAY() ) )
- chrisread9907Frequent Visitor
Thank you very much, how can i format this as a date to display it in a visual?
- InsightSoporteRegular Visitor
I have moths looking for a solution about this mesure or calculate.
This table has a group of variable in multiple columns in excel file , i need to find each variable in all Q1_# and count, also and get % for the sum of all variable.
In the image you can find the chart to expect and the output table.
Using "=COUNTIF(EXCELTABLE,VARIABLETOFIND)/COUNTA(Q1_#)"
*Q1_# All columns Q1 - AnonymousNot applicable
hi
I have two simple questions, how do I calculate what is described below.
Year value
2019 200
2018 100
2018 100
2019 200
2019 100
2018 50
The average year = 2019 is 166.67
Add up if Year = 2019 is 500- Ashish_MathurSuper User
Hi,
Drag Year to the row labels of your visual. Write these measures
Total = SUM(Data[Value])
Average = AVERAGE(Data[Value])
Hope this helps.
- AnonymousNot applicable
Thank you for the answer, with a formula like that do all of them count? What if only 2019 counted.