cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

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.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors