Forum Discussion
Add up and evaluate
Hello everyone,
I need help with a code in Power Bi.
I have 2 columns. In column 1 I have numbers in it, which can also repeat:
23 true
62 false
55 true
23 true
23 false
42 false
...
In column 2, a true or false value is stored for each number.
What is the code for the new column if I add up all the same numbers in column 1 and then want to check that if only one of the group of numbers added up is false, they are all false in the group of numbers?
It should look like this:
Column 1 / Column 2 / New column
23 true false
62 false false
55 true true
23 true false
23 false false
42 false false
52 true true
6 true true
...
I am grateful for any help!
- Anonymous2 years ago
Hi Dominik-1988 ,
Please follow these steps:
- Number of groupings Number of rows
Column = CALCULATE ( COUNT ( 'Table'[number] ), FILTER ( 'Table', 'Table'[number] = EARLIER ( 'Table'[number] ) ) )- Output blank when equal to 1, output ”t or f” when greater than 1
Column 2 = VAR _1 = IF ( 'Table'[Column] > 1, 'Table'[t or f], BLANK () ) RETURN MAXX ( FILTER ( 'Table', 'Table'[number] = EARLIER ( 'Table'[number] ) ), _1 )- When the values are the same, if there is a false, output false.
result = VAR _1 = MINX ( FILTER ( 'Table', 'Table'[number] = EARLIER ( 'Table'[number] ) ), 'Table'[Column 2] ) RETURN IF ( 'Table'[Column] = 1, 'Table'[t or f], _1 )- final output
How to Get Your Question Answered Quickly - Microsoft Fabric Community
If it does not help, please provide more details with your desired out put and pbix file without privacy information.
Best Regards,
Yifan Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- AnonymousNot applicable
Hi Dominik-1988 ,
Please follow these steps:
- Number of groupings Number of rows
Column = CALCULATE ( COUNT ( 'Table'[number] ), FILTER ( 'Table', 'Table'[number] = EARLIER ( 'Table'[number] ) ) )- Output blank when equal to 1, output ”t or f” when greater than 1
Column 2 = VAR _1 = IF ( 'Table'[Column] > 1, 'Table'[t or f], BLANK () ) RETURN MAXX ( FILTER ( 'Table', 'Table'[number] = EARLIER ( 'Table'[number] ) ), _1 )- When the values are the same, if there is a false, output false.
result = VAR _1 = MINX ( FILTER ( 'Table', 'Table'[number] = EARLIER ( 'Table'[number] ) ), 'Table'[Column 2] ) RETURN IF ( 'Table'[Column] = 1, 'Table'[t or f], _1 )- final output
How to Get Your Question Answered Quickly - Microsoft Fabric Community
If it does not help, please provide more details with your desired out put and pbix file without privacy information.
Best Regards,
Yifan Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.