Forum Discussion
Calucaltion on Filtered set op Rows when Value is containing in A collumn
Hello Guys,
I am trying to get a measure (of calculated collumn) in my Power BI that returns a SUM of a specific value.
To be more specific;
The table i have is;
Empl | Month | Value | Year
A 1 0 2016
A 1 0 2016
A 1 1 2016
A 1 0 2016
A 2 1 2016
A 2 0 2016
A 3 0 2016
B 1 1 2016
B 2 0 2016
B 2 1 2016
B 2 0 2016
B 2 0 2016
I would like to calculate each Year/Month per Employee the Value, when The rows for the specific Year/Month/Employee is Containing at least one row with zero (0) then the result of the measure should be 0, else the result should be 1.
In other words; the above table should result in
Empl | Month | Measure Result | Year
A 1 0 2016
A 2 0 2016
A 3 1 2016 <<The rows of same year, Month, Employee is only containing the value 1 and no other rows with the value 0
B 1 1 2016<<The rows of this year, Month, Employee is only containing the value 1 and no other rows with the value 0
B 2 0 2016
Last but not least i would like to SUM the results Per year and Month on all employees.
I realy hope someone could help me out on this matter, i would realy appreciate it!
In this scenario, you can create two measures with following formulas to get the results.
Measure Result = IF ( SUM ( Table1[Value] ) < COUNTROWS ( Table1 ), 0, 1 )
Measure Total = SUMX ( SUMMARIZE ( Table1, Table1[Empl], Table1[Month], Table1[Year], "Measure Result", [Measure Result] ), [Measure Result] )Best Regards,
Herbert
1 Reply
- v-haibl-msftMicrosoft Employee
In this scenario, you can create two measures with following formulas to get the results.
Measure Result = IF ( SUM ( Table1[Value] ) < COUNTROWS ( Table1 ), 0, 1 )
Measure Total = SUMX ( SUMMARIZE ( Table1, Table1[Empl], Table1[Month], Table1[Year], "Measure Result", [Measure Result] ), [Measure Result] )Best Regards,
Herbert