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
Anonymous
Not applicable

Data Manipulation/Calculated Column Creation Help

Hello, I am perplexed by a problem on how to manipulate my data.  Essentially, I need to create a new column that determines if a customer account is active or inactive based on whether they have any active contracts or not. My raw data is presented like this:

Origin.jpg


I need to make the above table look like this:

Output.jpg

Once I am able to display the above, I can manipulate it to provide the appropriate counts, etc.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous

 

Create 3 measures for this.

Status = IF([Active Contracts]>0, "Active","Inactive")

Active Contracts =  CALCULATE(COUNT('Status Column'[Contract Number]), FILTER('Status Column','Status Column'[Status]="Active"))

InActive Contracts = CALCULATE(COUNT('Status Column'[Contract Number]), FILTER('Status Column','Status Column'[Status]="Inactive"))

Status.PNG 

 

Hope this is clear.

 

Thanks
Raj

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi

  Can you please post the data in text format so that it can be copied?

 

Thanks
Raj

Anonymous
Not applicable

 

Here you go:

Customer NumberContract NumberContract Status
1231000TRUE
1232000TRUE
4563000FALSE
4564000TRUE
4565000

TRUE

7896000

FALSE

7897000

FALSE

7898000

FALSE

 

Anonymous
Not applicable

Hi @Anonymous

 

Create 3 measures for this.

Status = IF([Active Contracts]>0, "Active","Inactive")

Active Contracts =  CALCULATE(COUNT('Status Column'[Contract Number]), FILTER('Status Column','Status Column'[Status]="Active"))

InActive Contracts = CALCULATE(COUNT('Status Column'[Contract Number]), FILTER('Status Column','Status Column'[Status]="Inactive"))

Status.PNG 

 

Hope this is clear.

 

Thanks
Raj

Anonymous
Not applicable

should the 'Status Column' in your measures be the table name? ex: Active Contracts = CALCULATE(COUNT('Sheet1'[Contract Number]), FILTER('Sheet1','Sheet1'[Status]="Active")) 

 

When I use the table/column name conventions, I'm prompted with this dialogue box:

dialogue.jpg
Anonymous
Not applicable

nevermind, i converted the original column into a text type from True/False on the modeling tab.

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.