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
Murkow
Frequent Visitor

Return 1 if any row with the same name contains 1 in a particular column

Hi,

can't think of formula no matter how hard I try

 

I'll  demonstrate it on an example to make it easier to understand.

I have multiple rows with the same name.

Then I have date. I made a new column where I find out, if the row is from this week (return 1 if it is)

Now I need a New Column, where it retuns 1 to every row, where there is at least one 1 in This week column for that project.

Any ideas?

See the screen below.

Thanks in advance

 

PBI Forum.jpg

 

Project 2 has no 1 in nolumn This week which means it has 0 in every Project 2 row in New Column.

Project 1 and Project 3 have at least one row where there is 1 in Column This week so there is 1 in every Project 1 and Project 3 row in column New Column.

Please, how do I get the New Column formula?

1 ACCEPTED SOLUTION
ForcaTaico
Resolver II
Resolver II

Hey Murkow

 

Insted of a new colunm you could duplicate your query and do a "Group by" around [Project] and take the max. of [This week]. Then merge the two queries around [Project] and expand the column with the max. of [This week].

 

Regards Taico

View solution in original post

7 REPLIES 7
Eric_Zhang
Employee
Employee

@Murkow

You can create to create calculated column as

Column = CALCULATE(MAX('table'[This Week]),ALLEXCEPT('table','table'[Project]))

Capture.PNG

Thank you everybody, everything was helpful.

I did it by grouping. Created new column in query where I got TRUE/FALSE if it was in this week. Then I duplicated it, grouped by project and, chynged TRUE/FALSE to 1/0 and maxed this new column like Taico advised me.

 

 

ForcaTaico
Resolver II
Resolver II

Hey Murkow

 

Insted of a new colunm you could duplicate your query and do a "Group by" around [Project] and take the max. of [This week]. Then merge the two queries around [Project] and expand the column with the max. of [This week].

 

Regards Taico

Hi Taico,

oh I see... that might be the way. But i can't really take the max of This week.

This week is a new created IF column and it doesn't offer me to even pick this column.

Is there any way to add this column to query?

 

Thanks

When you do the "group by" only select the column [Project] then you should be able to take the max. of your custom column [This week]. 

Murkow
Frequent Visitor

Since I don't have Current Week column in query editor, can somebody think of a formula on my first question?

Or give me an advice on how to creat a new column in query editor, where there should be 1 if it is in current week based on the date of th row?

Thanks

You could also add an calculated column after the query is loaded.

=IF(CALCULATE(COUNTROWS(Table),FILTER(Table,EARLIER(Table[Project])=Table[Project] && Table[This week]=1))>0,1,0)

...in addition you could add the date criteria in the formular.

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.