cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hicham Member
Member

Need help on a calculate column

Hi,

I'm making a dax command to create a flag in a message like "present / no present"  so to do that I use data in column A and B, the two columns come from the same table named: table 1, in column A I have some letters and in column B I have their respective codes, like is shown in the picture below. The measure that I want to do is to create a third column that shows a message "present" if one letter from column A has code as Control and other codes (A1, A5...) from column B; and I would show also "no present" if one letter from column A has only code as Control from column B.             

Thank you! My best regards

 

231.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User IV
Super User IV

Re: Need help on a calculate column

So probably something like:

 

Column = 
VAR __table = FILTER(ALL('Table'),[Column A] = EARLIER([Column A]))
VAR __controls = FILTER(__table,[Column B] = "Control")
VAR __count = COUNTROWS(__controls)
RETURN
IF(__count>1,"Present","No Present")

I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
Super User IV
Super User IV

Re: Need help on a calculate column

So probably something like:

 

Column = 
VAR __table = FILTER(ALL('Table'),[Column A] = EARLIER([Column A]))
VAR __controls = FILTER(__table,[Column B] = "Control")
VAR __count = COUNTROWS(__controls)
RETURN
IF(__count>1,"Present","No Present")

I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

View solution in original post

Super User IV
Super User IV

Re: Need help on a calculate column

Greg has got a great solution, you could also do it in Power Query?




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Power BI Blog
Hicham Member
Member

Re: Need help on a calculate column

@Greg_Deckler  Thank you for answering me! great! I would like to ameliorate this measure by going much deeper in the granularity, So I would like to use another column as filter as is shown in the picture. 

 

The measure that I want to do is to create a third column that shows a message "present" if one letter from column A has code as Control and other codes (A1, A5...) from column B and the same package from column C; and I would show also "no present" if one letter from column A has only code as Control from column B and the same package from column C.                                          

In column we have the same package. Thank's again for your response. Best regards. 

      

89456.PNG

 

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors