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
Anonymous
Not applicable

desktop

Hi,

 

i am facing an issue with dax, i have written a if condition to create a new column. need a support to fix this problem asap.

i am explaining the issue with dummy data, i have two columns like A, B and have calculated column as C. 

Condition is:- C= If( A!=0 then B/A else 0). Please find thebelow image to know better 

Dax query with resultsDax query with resultsIf you see the above pic i am unable to get exact value for ovarall like 25/27 as 92.6%(this is the result i am expecting) but i am getting result like 404.0% as sum of 'C' column. if i take average it getting like 57.7% as 404.0/7=57.7%taking sumtaking sumtaking avg of Ctaking avg of C

So kindly help me on this. Its much appricitated. Thanks in advance. 

 

2 ACCEPTED SOLUTIONS
Wickin
Frequent Visitor

Try creating the following measure (not a column):

 

C =
DIVIDE ( SUM ( dummy[B] )SUM ( dummy[A] )0 )

View solution in original post

You had the result you wanted in your previous post...

View solution in original post

10 REPLIES 10
Wickin
Frequent Visitor

Try creating the following measure (not a column):

 

C =
DIVIDE ( SUM ( dummy[B] )SUM ( dummy[A] )0 )
Anonymous
Not applicable

Thanks a lot Wickin for your quick response.

It's working but i tried this but i am expecting the result like row wise like below

want to see the result like this including 92.6% in Red color boxwant to see the result like this including 92.6% in Red color box expecting all the rows with % and in the end also the same like 

A   B  C

---------------

7    6  85.7%

4    3  75.0%

9    6  66.7%

5    3  60.0%

2    1  50.0%

0    6  00.0%

-----------------

27   25   92.6%

 

 

Thanks in advance.

 


@Anonymous wrote:

Thanks a lot Wickin for your quick response.

It's working but i tried this but i am expecting the result like row wise like below

 


Our formulas do that. You might need to turn off summarisation/turn on values with no data in your visual.

Anonymous
Not applicable

Thanks a lot JThomson and Wickin for the resolution for my issue. It worked well.

Anonymous
Not applicable

Hello JThomson, while using "C = DIVIDE ( SUM ( dummy[B] ), SUM ( dummy[A] ), 0 )" formula i am getting the below result.

with sum on both the columns A, B.Capture9.JPG

 

 

 

 

 

 

 

 

 

 

 

if i apply don't summarise, getting below result

Capture7.JPG

 

if i use the "C = IF(dummy[A] <> 0, (dummy[B]/dummy[A]), 0)" formula. getting the below results  but not able to get as 92.6% as totals under C column. If its fixed. then i am fine..As per the client requiremnt,  if A is not equals to 0 then B/A else 0.

Have almost 30 million records are there thats why explainin my senorio with dummy data.

Capture6.JPG

Capture4.JPG

i have taken the Table as visual and if i get the value 92.6% in first ed box with all the rows. Then my met my requirment.

Thanks

Anonymous
Not applicable

Hi JThomson/Wickin ...kindly help on the below to sort out. Thanks in advance

You had the result you wanted in your previous post...

Not sure what result you're seeing currently.

Could you please add your PBIX file?

Anonymous
Not applicable

I am unable to attach here cn you pls share your email id so that i will share the .pbix file with you.

jthomson
Solution Sage
Solution Sage

See what c = divide (b, a, 0) does, may need to make it sum(a) and sum (b)

 

Would also help if you use a descriptive topic title in the future...

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.