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.
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
If 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%
So kindly help me on this. Its much appricitated. Thanks in advance.
Solved! Go to Solution.
Try creating the following measure (not a column):
C =
DIVIDE ( SUM ( dummy[B] ), SUM ( dummy[A] ), 0 )
You had the result you wanted in your previous post...
Try creating the following measure (not a column):
C =
DIVIDE ( SUM ( dummy[B] ), SUM ( dummy[A] ), 0 )
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
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.
Thanks a lot JThomson and Wickin for the resolution for my issue. It worked well.
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.
if i apply don't summarise, getting below result
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.
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
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?
I am unable to attach here cn you pls share your email id so that i will share the .pbix file with you.
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...
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
152 | |
120 | |
102 | |
87 | |
68 |