Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

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 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 avg of C

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

 

  • Try creating the following measure (not a column):

     

    C =
    DIVIDE ( SUM ( dummy[B] )SUM ( dummy[A] )0 )
  • jthomson's avatar
    jthomson
    8 years ago

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

10 Replies

  • jthomson's avatar
    jthomson
    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...

  • Wickin's avatar
    Wickin
    Frequent Visitor

    Try creating the following measure (not a column):

     

    C =
    DIVIDE ( SUM ( dummy[B] )SUM ( dummy[A] )0 )
    • Anonymous's avatar
      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 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.

      • Wickin's avatar
        Wickin
        Frequent Visitor

        Not sure what result you're seeing currently.

        Could you please add your PBIX file?