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

Looking for assistance adding a custom calculated column for each row

I have a unique ticket identifier in another table which then breaks out each critical application into individual columns to measure TRUE/FALSE on whether the application was impacted during the incident.

 

Here is an example of a similar table (call it table 1):

TickName|CreateDate|App1|App2|App3|App4

1              | 1/1/2000  |True  |False |True  |False
2              | 1/2/2000  |True  |True  |False |False

3              | 1/3/2000  |False |True  |False |False

Because I cannot have an organized graph showing a break down of my critical applications with total impacts, I have a new table (Call it table 2) created called Critical apps and is currently setup with one column as:

CritApp|
App 1   |
App 2   |
App 3   |
App 4   |

I have an expression to calculate the number of true/false for each application as follows:

App 1 True Count = CALCULATE(COUNTROWS(FILTER('Table 1','Table 1'[App 1] = TRUE())))
Return is 2
App 2 True Count = CALCULATE(COUNTROWS(FILTER('Table 1','Table 1'[App 2] = TRUE())))
Return is 2
App 3 True Count = CALCULATE(COUNTROWS(FILTER('Table 1','Table 1'[App 3] = TRUE())))
Return is 1
App 4 True Count = CALCULATE(COUNTROWS(FILTER('Table 1','Table 1'[App 4] = TRUE())))
Return is 0
 
How would I be able to populate those values into Table 2 to look as follows:
CritApp| Count
App 1   | 2
App 2   | 2
App 3   | 1
App 4   | 0

((And of course would recalculate as data gets added/updated))
 
 
Thanks in advance!!
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

HI, @Anonymous 

You may try to unpivot the table 1 in edit queries, and then create a relationship with table 2 as below:

Step1:

In Edit Queries, select all "App" columns, then unpivot these columns.

https://radacad.com/pivot-and-unpivot-with-power-bi

4.JPG

Step2:

Create a relationship between table1 and table 2.

Step3:

Create a measure by this formula:

Measure = CALCULATE(COUNTROWS(FILTER('Table 1','Table 1'[Value]= TRUE())))+0

Result:

5.JPG

and here is my pbix file, please try it.

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

HI, @Anonymous 

You may try to unpivot the table 1 in edit queries, and then create a relationship with table 2 as below:

Step1:

In Edit Queries, select all "App" columns, then unpivot these columns.

https://radacad.com/pivot-and-unpivot-with-power-bi

4.JPG

Step2:

Create a relationship between table1 and table 2.

Step3:

Create a measure by this formula:

Measure = CALCULATE(COUNTROWS(FILTER('Table 1','Table 1'[Value]= TRUE())))+0

Result:

5.JPG

and here is my pbix file, please try it.

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
d_gosbell
Super User
Super User

I would pivot "table 1" as follows in Power Query and only keep the "true" rows, then you can join "table 2" on the new application column and your measure could be a distinctcount of TickName and it will work across dates and applications. (and adding new applications will not need a change in your model and measures)

 

TickName|CreateDate|Application

1              | 1/1/2000  |App1
1              | 1/1/2000  |App3
2              | 1/2/2000  |App1
2              | 1/2/2000  |App2

3              | 1/3/2000  |App2

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.

Top Solution Authors