Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Help in dax grouping formulas

Hi guys,

 

Can anybody help me to create formulas from red columns ?? 

% of total transactions event_type = D2/SUMA($D$2:$D$14)

AVG from last 30 days by event type = the same rule so avarge number of transaction and grouping is by all columns with values  for example 1 row: AE,0,TEV_CREATED 

trx_snapshot_denormalized.cardInfo_countrysequenceNumbereventTypeNumber of transaction% of total transactions event_typeAVG from last 30 days by event type
AE0TEV_CREATED1914%16,5
AE1TEV_PAYMENT_INFO_UPDATED1914%12,3
AE2TEV_SECURITY_CHECK_REQUESTED1914%12,3
AE3TEV_SECURITY_CHECK_APPROVED1814%0,002
AE3TEV_SECURITY_CHECK_REJECTED11% 
AE4TEV_THREE_DS_VERIFICATION_STARTED1814% 
AE5TEV_AUTHORISATION_ATTEMPT129% 
AE5TEV_REJECTED11% 
AE6TEV_AUTHORISATION_REJECT86% 
AE6TEV_AUTHORISED43% 
AE7TEV_ACCEPTED43% 
AE7TEV_REJECTED86% 
AE8TEV_CANCELED11% 
AG0TEV_CREATED113% 
AG1TEV_PAYMENT_INFO_UPDATED113% 
AG2TEV_SECURITY_CHECK_REQUESTED113% 
AG3TEV_SECURITY_CHECK_APPROVED113% 
AG4TEV_THREE_DS_VERIFICATION_STARTED113% 
AG5TEV_AUTHORISATION_ATTEMPT113% 
AG6TEV_AUTHORISATION_REJECT113% 
AG7TEV_REJECTED113% 

 

Many thx for he

 
 
  • Anonymous's avatar
    Anonymous
    6 years ago

    Solve it using :

     

    % of Total transaction No group by = DIVIDE((events_tpr_card[Number of transaction]);CALCULATE(events_tpr_card[Number of transaction];All(events_tpr_card[eventType];events_tpr_card[sequenceNumber])))

3 Replies

  • Hi Anonymous ,

     

    First of all don't know if the naming of the columns is correct but I did the following measure:

    % over transaction type =
    SUM ( 'Table'[CountrysequenceNumbereventType] )
        / CALCULATE (
            SUM ( 'Table'[CountrysequenceNumbereventType] );
            ALL ( 'Table'[CountrysequenceNumbereventType] );
            ALLEXCEPT ( 'Table'; 'Table'[trx] )
        )

     

     Regading the last column how do you calculate the number? I can understand the formula for the first row (132 / 😎 but not for the next ones.

     

    Regards,

    MFelix

  • v-lili6-msft's avatar
    v-lili6-msft
    Icon for Community Support rankCommunity Support

    hi Anonymous 

    You could use EARLIER Function to create a calculate column as below:

    https://docs.microsoft.com/en-us/dax/earlier-function-dax

    https://powerpivotpro.com/2012/03/the-correct-usage-of-earlier/

    % over transaction type column = 
     'Table'[Number of transaction] 
        / CALCULATE ( SUM ( 'Table'[Number of transaction] ), FILTER(  'Table', 'Table'[trx_snapshot_denormalized.cardInfo_country] =EARLIER('Table'[trx_snapshot_denormalized.cardInfo_country])))

    For the last column. it has the same logic.

     

    Regards,

    Lin

    • Anonymous's avatar
      Anonymous
      Not applicable

      Solve it using :

       

      % of Total transaction No group by = DIVIDE((events_tpr_card[Number of transaction]);CALCULATE(events_tpr_card[Number of transaction];All(events_tpr_card[eventType];events_tpr_card[sequenceNumber])))