Power BI Exchange

Please login or click SIGN UP FOR FREE to create your PowerBIUG account to join this user group.
Expand all | Collapse all

DAX CALCULATION

Jump to Best Answer
  • 1.  DAX CALCULATION

    Posted 14 days ago
    Edited by Moshood Adeleye 14 days ago
    Good day Friends,

    I am having trouble developing a measure that groups and then calculates or return a unit value.

    For example, If the total number of trips reaches 20 for a customer, I want 1 to be returned, if it reaches 40, I want 2, if it reaches 60, I want 3 and so on...

    Can anyone help with the above request??

    Thank you.

    Let me know if any other questions are required.


    ------------------------------
    Moshood Adeleye
    BI Analyst
    ------------------------------


  • 2.  RE: DAX CALCULATION
    Best Answer

    Posted 11 days ago
      |   view attached
    Hi @Moshood Adeleye,

    if I understand your question correctly see below the measure ​

    Rank =
    var trips=SELECTEDVALUE('Table'[#Trips])
    return
    SWITCH(true(),trips<20,0,trips<39,1,trips<59,2,trips<79,3,4)

    see attach file too

    please review it and send me your feed back.

    Thanks,
    Feras


    ------------------------------
    Feras Alramli
    Oshawa
    ------------------------------

    Attachment(s)

    pbix
    MashoodAdeley.pbix   14 KB 1 version


  • 3.  RE: DAX CALCULATION

    Posted 11 days ago
    Thank you very much Feras,

    You really helped me out.

    All I had to do was to change the SELECTEDVALUE() function to CALCULATE() cos I needed to use a calculated measure and it worked just like I wanted.

    God bless you.

    Thanks once again.

    ------------------------------
    Moshood Adeleye
    BI Analyst
    ------------------------------