Forum Discussion

anglefbi11's avatar
anglefbi11
Helper I
1 year ago
Solved

issue with measure calculation

hi dears

i created a measure to calculate the difference between 2 numbers

 

the issue that it gave me some wrong percentage

 

some of them are giving me the correct answer and some of the is showing wrong percent

 

kindly see the below screenshot

 

 

 

 

 

 

 

the masures which i used 

***************

percentage = CALCULATE([rulecount]-[abc])/[abc]

 

********

 

abc = CALCULATE(

    COUNT(Sheet1[Rule])/3,

    DATESINPERIOD(

        'calendar'[Date],

        EOMONTH(MAX('calendar'[Date]), -1), -- End date is the last day of the previous month

        -3, -- Go back 3 months from the previous month

        MONTH

    )

)

 

 

*****

 

rulecount = COUNT(Sheet1[Rule])

 

 

 

*****

 

 

there is no filtere in my visual i am using table view only

 

what should i do to correct it ?

  • anglefbi11 ,

    Believe your issue is a rounding issue.  Your value of 162 is probably closer to 161.65.  You are simply displaying a rounded value.  To test this, display two decimal places in your [abc] measure in your visual.
    You can fix this by using the ROUND function in your [abc] measure.  This should round up the result to 162 which will give the percentage you are looking for.

    Hope this resolves your issue.

    Regards,

2 Replies

  • rsbin's avatar
    rsbin
    Community Champion

    anglefbi11 ,

    Believe your issue is a rounding issue.  Your value of 162 is probably closer to 161.65.  You are simply displaying a rounded value.  To test this, display two decimal places in your [abc] measure in your visual.
    You can fix this by using the ROUND function in your [abc] measure.  This should round up the result to 162 which will give the percentage you are looking for.

    Hope this resolves your issue.

    Regards,

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi anglefbi11 

     

    Thank you rsbin for your attention and reply to this thread.


    I would like to ask if rsbin's reply has helped you to solve the problem? If so, please consider accepting his reply as a solution.
    If the problem is still not solved, please provide some sample data that can cover your problem, we will reproduce the problem and debug the DAX formula based on the sample data and finally provide you the solution. It would be better to provide pbix files if possible. (Remove privacy information)

     

    Best Regards,
    Jarvis Tang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.