Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

keeping fixed values

i need to find the percentage diffrence between No_Visit and Completed_Visits as (completed visits / total No_visits). No_visit is total of year 2020 and it shoulld be fixed. completed visit should be change according to date slicer. (example :  for 01/01/2020 to 01/31/2020  percentage diffrence = 1224/12200,  for 01/01/2020 to 12/31/2020 - percentage diff = 150226/12200. i need to keep the total value of no_visit to be fixed for the particlar year alone,the value  should not change while using date slicer, only completed visit should change according to date range 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous,

    Regarding this post, did you get the results you wanted? If so, could you please mark the helpful post as Answered? This will also help others in the community if they are having the same problem as you. Thank you.

    Best Regards

6 Replies

  • Anonymous , with help from date table complete year value

     

    This Year = CALCULATE(sum('Table'[No_visit]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))

     

    This year Sales = CALCULATE(sum('Table'[No_visit]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))

     

    Force only 2020

    This Year = CALCULATE(sum('Table'[No_visit]),filter(ALL('Date'),'Date'[Year]=2020 ))

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      im getting the value as infinity 

      • amitchandak's avatar
        amitchandak
        Super User

        Anonymous , what formula you have used and what you got in denominator

         

        Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    I created a sample pbix file(see attachment), please check whether that is what you want. You can create a measure as below:

    percentage diffrence = 
    VAR _nvisits =
        CALCULATE ( SUM ( 'Table'[No_Visit] ), ALL ( 'Table' ) )
    VAR _cvisits =
        CALCULATE ( SUM ( 'Table'[Completed visit] ) )
    RETURN
        DIVIDE ( _cvisits, _nvisits, 0 )

     

    Best Regards

    • Anonymous's avatar
      Anonymous
      Not applicable

      thank you

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous,

        Regarding this post, did you get the results you wanted? If so, could you please mark the helpful post as Answered? This will also help others in the community if they are having the same problem as you. Thank you.

        Best Regards