Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Special Measure

I'm looking for a special DAX-Code!

 

I want to be able to divide my net sales with changing numbers. I want to deposit the numbers in a table and decide on my own when i want to take which digit of the collumn

 

I do not want to write the numbers (e.g.: 1, 10, 100, ...)  with which I divide but select them from a table

 

Please, I need help ASAP

 

Best regard

Tobias

 

  • Hey,

     

    you can the number you want use for the division to a slicer.

     

    Then create a measure like so:

    SelectedNumber = 
    SELECTEDVALUE('<tablename>'[ColumnThatContainsTheNumber] , defaultvalue)

    Then just create a second measure for the division like so:

    TheDivision = 
    DIVIDE([my net sales] , [SelectedNumber])

    Hopefully this will provide what you are looking for.

     

    Regards,

    Tom

     

     

3 Replies

  • AlB's avatar
    AlB
    Community Champion

     

    1. Create a one-column table with the values you need (1,10,100...). Let's call it AuxTable[Number] 

    2.  Place AuxTable[Number] in a slicer   

    3. Create this measure, which will give you the number selected in the slicer  

     

    Measure = SELECTEDVALUE(AuxTable[Number])  
    

    4. Use the measure wherever you need the selected number 

     

    Please mark the question solved when done and consider giving kudos if posts are helpful.

    Cheers  Datanaut

     

  • Hey,

     

    you can the number you want use for the division to a slicer.

     

    Then create a measure like so:

    SelectedNumber = 
    SELECTEDVALUE('<tablename>'[ColumnThatContainsTheNumber] , defaultvalue)

    Then just create a second measure for the division like so:

    TheDivision = 
    DIVIDE([my net sales] , [SelectedNumber])

    Hopefully this will provide what you are looking for.

     

    Regards,

    Tom