cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

error with if and calculate

trying to replace the total in a grid

 

using this measure:

 

Merchant MultiProduct Flag =
if(isinscope('Dim View_MID_Properties'[MERCHANT_NUMBER]), if([Merchant Product distinctcount] >= 2, 1, 0), calculate([merchant_number count], [Merchant Product distinctcount] > 1))
 
get this error:
 
The report measure 'Dim view_mid_properties[Merchant MultiProduct Flag] has a syntax or semantic error at line 2, position 143, reported by Analysis Services: 'A function 'Calculate' has been used in a true/false expression that is used as a table filter expression.  This is not allowed.
 
how do I correct this?
 
Merchant MultiProduct Flag =
if(isinscope('Dim View_MID_Properties'[MERCHANT_NUMBER]), if([Merchant Product distinctcount] >= 2, 1, 0), 5) puts a 5 in the total line
 
Merchant Product distinctcount = calculate(
DISTINCTCOUNTNOBLANK('Dim Latest Product Per Mid'[Product_Code_and_Name]))
it uses a calculate statement so I don't understand why the calculate that follows gives an error
 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

HI @bsheffer ,,

 

Measure = 

calculate([merchant_number count],  FILTER (Dim View_MID_Properties', [Merchant Product distinctcount] > 1))

 

Regards,

HN

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Hi @bsheffer ,

 

 

Try this

 

Merchant MultiProduct Flag =
SWITCH (
    TRUE (),
    ISINSCOPE ( 'Dim View_MID_Properties'[MERCHANT_NUMBER] )
        && [Merchant Product distinctcount] >= 2, 1,
    ISINSCOPE ( 'Dim View_MID_Properties'[MERCHANT_NUMBER] )
        && [Merchant Product distinctcount] < 2, 0,
    5
)

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Highlighted

no it still has issues with the 

calculate([merchant_number count], [Merchant Product distinctcount] > 1)
when I replace the 5 with it.
 
btw merchant_number_count is
merchant_number count = count('Dim View_MID_Properties'[MERCHANT_NUMBER])
Highlighted

HI @bsheffer ,,

 

Measure = 

calculate([merchant_number count],  FILTER (Dim View_MID_Properties', [Merchant Product distinctcount] > 1))

 

Regards,

HN

View solution in original post

Highlighted

thanks

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors