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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
rjsidek
Helper II
Helper II

Creating a measure with IF statement

Hi everyone,

 

I have a dataset that looks like this

 

ques.png

 

I have a list of companies where their "Status of deal" changes over time. What I want to create is this:

 

I want to create a measure whereby if a company has ever been active, return "Yes", else, return "No". I want to then display this in a card. I can't figure out a way to do this yet. I tried creating a conditional column but it returns the "Yes" or "No" by column, and not by Company Name. 

 

Would appreciate any input. 

 

Thanks

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Add a new column like

Is Active = 

var cnt =countx(filter(table,table[company]=earlier(table[company]) && (table[company]="Active" Or ealier(table[company]="Active"))),table[company])

return
if(cnt>0,"Yes","No")

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Datanaut Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

Add a new column like

Is Active = 

var cnt =countx(filter(table,table[company]=earlier(table[company]) && (table[company]="Active" Or ealier(table[company]="Active"))),table[company])

return
if(cnt>0,"Yes","No")

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Datanaut Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

This worked great. Thanks so much!

JirkaZ
Solution Specialist
Solution Specialist

@rjsidek Well in the proper data model you would have a Company table with distinct company names and that table would be related to the Company History table (the one you have now). Then it would be simple to create a new column in the Company table using COUNTROWS(FILTER...

Can you elaborate a bit on how I would be able to achieve this?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors