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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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