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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

facing error in problem

Select Conversion=IF(ISBLANK(CALCULATE(DIVIDE(COUNTX(FILTER('CUSTOMER Lookup',[Type]="MEMBER"),[CUSTid])
,CALCULATE([CUSTid],all(Customer))),0,CALCULATE(DIVIDE(COUNTX(FILTER('CUSTOMER Lookup',[Type]="MEMBER"),[CUSTid])
,CALCULATE([CUSTid],all(Customer))))

 

Capture.JPG

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

Try like

 Select Conversion=IF(ISBLANK(CALCULATE(DIVIDE(COUNTX(FILTER('CUSTOMER Lookup',[Type]="MEMBER"),[CUSTid])
,CALCULATE([CUSTid],all(Customer))))),0,CALCULATE(DIVIDE(COUNTX(FILTER('CUSTOMER Lookup',[Type]="MEMBER"),[CUSTid])
,CALCULATE([CUSTid],all(Customer)))))

View solution in original post

v-yiruan-msft
Community Support
Community Support

Hi @San1979 ,

Three right parenthesis were missing in your formula, please see the red mark in the formula below:

Select Conversion=IF(ISBLANK(CALCULATE(DIVIDE(COUNTX(FILTER('CUSTOMER Lookup',[Type]="MEMBER"),[CUSTid])
,CALCULATE([CUSTid],all(Customer))) )) ,
0,
CALCULATE(DIVIDE(COUNTX(FILTER('CUSTOMER Lookup',[Type]="MEMBER"),[CUSTid])
,CALCULATE([CUSTid],all(Customer)))) )

In addition, your formula looks a bit messy. In fact, you can organize your formula with the help of DAX formatting tool. And if the formula has any error, it will be easier and faster to find the cause after formatted.

Best Regards

Rena

Community Support Team _ Rena
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

5 REPLIES 5
v-yiruan-msft
Community Support
Community Support

Hi @San1979 ,

Three right parenthesis were missing in your formula, please see the red mark in the formula below:

Select Conversion=IF(ISBLANK(CALCULATE(DIVIDE(COUNTX(FILTER('CUSTOMER Lookup',[Type]="MEMBER"),[CUSTid])
,CALCULATE([CUSTid],all(Customer))) )) ,
0,
CALCULATE(DIVIDE(COUNTX(FILTER('CUSTOMER Lookup',[Type]="MEMBER"),[CUSTid])
,CALCULATE([CUSTid],all(Customer)))) )

In addition, your formula looks a bit messy. In fact, you can organize your formula with the help of DAX formatting tool. And if the formula has any error, it will be easier and faster to find the cause after formatted.

Best Regards

Rena

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

Hi @Anonymous ,

Three right parenthesis were missing in your formula, please see the red mark in the formula below:

Select Conversion=IF(ISBLANK(CALCULATE(DIVIDE(COUNTX(FILTER('CUSTOMER Lookup',[Type]="MEMBER"),[CUSTid])
,CALCULATE([CUSTid],all(Customer))) )) ,
0,
CALCULATE(DIVIDE(COUNTX(FILTER('CUSTOMER Lookup',[Type]="MEMBER"),[CUSTid])
,CALCULATE([CUSTid],all(Customer)))) )

In addition, your formula looks a bit messy. In fact, you can organize your formula with the help of DAX formatting tool. And if the formula has any error, it will be easier and faster to find the cause after formatted.

Best Regards

Rena

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

Yeah, that code is a mess. Always format your code properly to avoid this kind of thing. This is what I think you were going for:

 

Select Conversion=
	IF(
		ISBLANK(
			CALCULATE(
				DIVIDE(
					COUNTX(
						FILTER(
							'CUSTOMER Lookup',
							[Type]="MEMBER"
						),
						[CUSTid]
					),
					CALCULATE([CUSTid],all(Customer))
				)
			)
		),
		0,  //True statement
		CALCULATE(
			DIVIDE(
				COUNTX(
					FILTER(
						'CUSTOMER Lookup',
						[Type]="MEMBER"
					),
					[CUSTid]
				),
				CALCULATE([CUSTid],all(Customer))
			)
		)  //False statement
	)
	

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Also, here is a much, much better way to write that code:

 

Select Conversion=
	VAR __Calculation = 
		CALCULATE(
			DIVIDE(
				COUNTX(
					FILTER(
						'CUSTOMER Lookup',
						[Type]="MEMBER"
					),
					[CUSTid]
				),
				CALCULATE([CUSTid],all(Customer))
			)
		)
RETURN
	IF(ISBLANK(__Calculation),0,__Calculation)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

Try like

 Select Conversion=IF(ISBLANK(CALCULATE(DIVIDE(COUNTX(FILTER('CUSTOMER Lookup',[Type]="MEMBER"),[CUSTid])
,CALCULATE([CUSTid],all(Customer))))),0,CALCULATE(DIVIDE(COUNTX(FILTER('CUSTOMER Lookup',[Type]="MEMBER"),[CUSTid])
,CALCULATE([CUSTid],all(Customer)))))

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.