Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

dax

hi
i have these formulas from excel.
i am trying to re do them for dax.
=Table1[[#Totals],[Request ID]]
=COUNTIF(Table1[Engineer Visits],"1")
=D21/D20*100

  • Hi Anonymous 

     

    For the first two formulas, yon can try below codes to create measures.

     
    Totals = CALCULATE(SUM(Table1[Request ID]),ALL(Table1))
     
    Counts = CALCULATE(COUNT(Table1[Engineer Visits]),Table1[Engineer Visits]=1)
     
    For the last one, it's difficult to write a general formula for it without knowing what table and data is like. In Power BI, we cannot refer to a specified cell in a formula like what we do in Excel with "D21", "D20" because there is not a fixed row or column index in Power BI. We need some conditions to filter a row to get the value in a specified column.
    Hope this helps.
    Community Support Team _ Jing
    If this post helps, please Accept it as the solution to help other members find it.
     

2 Replies

  • negi007's avatar
    negi007
    Community Champion

    Anonymous to help you on this, we would more details like what calculation you are trying to attempt  from these formulas and details about your data as well. Please share your data and calcualtion you wish to do. 

     

    BAsed on limited deails you have provided you can create your dax like below in powerbi

     

    =Table1[[#Totals],[Request ID]]
    =calculate(sum(total))

     

    =COUNTIF(Table1[Engineer Visits],"1")

    =calculate(count(Table1[Engineer Visits],1)

     

    =D21/D20*100

    = divide(d21,d20)*100

     

    we will revert once we get more clarity frm you

  • v-jingzhang's avatar
    v-jingzhang
    Community Support

    Hi Anonymous 

     

    For the first two formulas, yon can try below codes to create measures.

     
    Totals = CALCULATE(SUM(Table1[Request ID]),ALL(Table1))
     
    Counts = CALCULATE(COUNT(Table1[Engineer Visits]),Table1[Engineer Visits]=1)
     
    For the last one, it's difficult to write a general formula for it without knowing what table and data is like. In Power BI, we cannot refer to a specified cell in a formula like what we do in Excel with "D21", "D20" because there is not a fixed row or column index in Power BI. We need some conditions to filter a row to get the value in a specified column.
    Hope this helps.
    Community Support Team _ Jing
    If this post helps, please Accept it as the solution to help other members find it.