Forum Discussion

erhan_79's avatar
erhan_79
Icon for Post Prodigy rankPost Prodigy
6 years ago
Solved

Calculating Rate

Hi there ;

 

İ would like to calculate below issue could you pls help me , let me explain pls sceneraio  first : 

 

i have a table as below which one you can see at left below ; i would like to calculate the rate " Customer Qty "of report for last day on report .

Customer Qty (counted ) on status "Actual Monh " total and between "Actual Month + Next Month " Total  ,

 

 

i tried to explain below picture what i need , i hope it is clear , thanks in advance for your kind supports 

 

 

  • Hello erhan_79 

    Give this a try.

    Rate = 
    VAR _Date = MAX ( YourTable[Report Date] )
    VAR _Act = CALCULATE ( COUNTROWS(YourTable), YourTable[Report Date] = _Date, YourTable[Status] = "Actual Month" )
    VAR _ActNext = CALCULATE ( COUNTROWS(YourTable), YourTable[Report Date] = _Date )
    RETURN 
    DIVIDE ( _Act, _ActNext )

     

2 Replies

  • Hello erhan_79 

    Give this a try.

    Rate = 
    VAR _Date = MAX ( YourTable[Report Date] )
    VAR _Act = CALCULATE ( COUNTROWS(YourTable), YourTable[Report Date] = _Date, YourTable[Status] = "Actual Month" )
    VAR _ActNext = CALCULATE ( COUNTROWS(YourTable), YourTable[Report Date] = _Date )
    RETURN 
    DIVIDE ( _Act, _ActNext )

     

  • mahoneypat's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft Employee

    Please try this expression in a measure:

     

    NewMeasure =
    VAR __maxdate =
        MAX ( Table[Report Date] )
    VAR __maxdatetable =
        FILTER ( Table, Table[Report Date] = __maxdate )
    VAR __actualmonthcount =
        COUNTROWS ( FILTER ( __maxdatetable, Table[Status] = "Actual Month" ) )
    VAR __nextmonthcount =
        COUNTROWS ( FILTER ( __maxdatetable, Table[Status] = "Next Month" ) )
    RETURN
        DIVIDE ( __actualmonthcount, __actualmonthcount + __nextmonthcount )

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat