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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Z4m
Frequent Visitor

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!

1 ACCEPTED SOLUTION
v-haibl-msft
Employee
Employee

@Z4m

 

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

Calucaltion on Filtered set op Rows when Value is containing in A collumn_1.jpg

 

Best Regards,

Herbert

 

View solution in original post

1 REPLY 1
v-haibl-msft
Employee
Employee

@Z4m

 

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

Calucaltion on Filtered set op Rows when Value is containing in A collumn_1.jpg

 

Best Regards,

Herbert

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.