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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
paguy215
Helper III
Helper III

Matrix - display 1 or -1 values based on a text field

I have a matrix displaying a series of columns, with the last column being a count of unique account numbers (summarizing on countd of those account numers)...So each row should have a 1 in that field.   However, I would like to be able indicate a -1 if something cancelled.   So I have a column that says if something is cancelled and is blank if it isn't.   How can I get that COUNTD of account numbers in that row to be -1 for cancelled and 1 for non-cancelled.  I tried using IFs but they don't work

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @paguy215 

 

Thanks for the reply from @Learner27 , please allow me to provide another insight:

 

My sample:

vxuxinyimsft_0-1715849559432.png

 

If you don't necessarily want to use a calculated column, try creating the following measure:

 

Measure = IF(MAX([cancelled]) = BLANK(), CALCULATE(DISTINCTCOUNT('Table'[account]), ALLEXCEPT('Table', 'Table'[account])), -1)

 

 

Output:

vxuxinyimsft_1-1715849877812.png

 

If this sample data is structurally different from the one you are using, please do not hesitate to mention it and I will modify it.

 

Best Regards,
Yulia Xu

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @paguy215 

 

Thanks for the reply from @Learner27 , please allow me to provide another insight:

 

My sample:

vxuxinyimsft_0-1715849559432.png

 

If you don't necessarily want to use a calculated column, try creating the following measure:

 

Measure = IF(MAX([cancelled]) = BLANK(), CALCULATE(DISTINCTCOUNT('Table'[account]), ALLEXCEPT('Table', 'Table'[account])), -1)

 

 

Output:

vxuxinyimsft_1-1715849877812.png

 

If this sample data is structurally different from the one you are using, please do not hesitate to mention it and I will modify it.

 

Best Regards,
Yulia Xu

 

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

Learner27
Helper III
Helper III

I belive it should work when you have created a calculated column. Could you provide your Sample PBIX file by hiding all the sensitive Data

Learner27
Helper III
Helper III

Hi  have you tried to create a new calculated column in your data table that assigns 1 for non-cancelled accounts and -1 for cancelled accounts.

Yes but that doens't work because there are multiple rows for each account ID in some cases ... IE maybe 3 or 4 regular ones plus the one record that's cancelled, so the matrix sums them, showing 3 positive and -1 negative...I would want only one distinct record for positive and for cancelled

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.