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
nbitabc
Helper I
Helper I

Calculated metric value resulting in cartesian results between dimensions

I am trying to add a custom flag value through a measure but it is returning multiple rows with blank metric value.

 

Here is a simple scenario - 

We have two rows for this Business Class, Customer Segment combination in our database for metric Total Amount Paid

nbitabc_1-1690581898133.png

 

Now we try to add a Flag value of Calculated Measure 

 

Service_Flag = IF (MAX(BUSINESS_CLASS[Business Class]) = "Auto Service Station" && MAX(CUSTOMER_SEGMENT[Customer Segment Code]) = "MOTORCYCLE_POWERSPORT_DEALER" && [Total Amount Paid] > 10000,1,0)

 

We get the right result but the report seems to bring in all combination of Dimensions Business Class and Customer Segment with blank Total Amount values. 

 

nbitabc_2-1690582041758.png

 

How do we get just the rows relevant with Metric values and suppress the blank metric rows?

1 ACCEPTED SOLUTION
nbitabc
Helper I
Helper I

Thank you @OwenAuger. This worked prefectly !

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

You can expand the filter pane and add a condition of 1 for that measure.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
nbitabc
Helper I
Helper I

Thank you @OwenAuger. This worked prefectly !

OwenAuger
Super User
Super User

Hi @nbitabc 

A quick fix is to add a condition that [Total Amount Paid] is nonblank, and also use a variable to avoid repeated evaluation:

 

Service_Flag =
VAR TotalAmountPaid = [Total Amount Paid]
RETURN
    IF (
        NOT ISBLANK ( TotalAmountPaid ),
        IF (
            MAX ( BUSINESS_CLASS[Business Class] ) = "Auto Service Station"
                && MAX ( CUSTOMER_SEGMENT[Customer Segment Code] ) = "MOTORCYCLE_POWERSPORT_DEALER"
                && TotalAmountPaid > 10000,
            1,
            0
        )
    )

 

I suggest putting this condition in an outer IF to avoid evaluating the existing expression unless necessary.

 

Does this work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

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.