Forum Discussion

orghn's avatar
orghn
Helper I
4 years ago

Error while filtering on slicer

Hi Everyone!

 

I have 2 tables, one with products and the other with laboratories. I need that both blank spaces have the value of the middle one (1514).

 

The measure is:

Precio_Mio = CALCULATE(MAX(PRECIOS_MENSUALES[PRECIO_ARS]),LABORATORIOS[DLABORATORIO]=SELECTEDVALUE(LABORATORIOS[DLABORATORIO]))
 
PRECIO_ARS is the price of that product and I have a Lab selected (the middle one) to get only that value. 

 

 

6 Replies

  • Hi orghn 

     

    Can you post sample data as text and expected output?
    Not enough information to go on;

    please see this post regarding How to Get Your Question Answered Quickly:
    https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.
    4. Relation between your tables

    Appreciate your Kudos!!
    LinkedIn:www.linkedin.com/in/vahid-dm/

    • orghn's avatar
      orghn
      Helper I

      Hi VahidDM , I send you sample data and tables, I can´t share the file due to privacy.

       

      Data:

      Product 1 from Lab a price 10

      Product 2 from Lab b price 15

      Product 3 from Lab c price 20

       

      I need to select a Lab in the slicer, for example Lab b and I need a table with an output in EACH ROW with value 15

      this values in yellow should be 15

       

      This is my dax:

      Precio_Mio = CALCULATE(MAX(PRECIOS_MENSUALES[PRECIO_ARS]),LABORATORIOS[DLABORATORIO]=SELECTEDVALUE(LABORATORIOS[DLABORATORIO]))

       

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi orghn ,

     

    In the table you provided, unlink the Lab table from the Product table. Then try the following formula:

    My_Price =
    VAR sel_lab =
        SELECTEDVALUE ( Lab[Lab Name] )
    RETURN
        CALCULATE (
            SUM ( 'Price'[Price] ),
            ALLEXCEPT ( 'Price', 'Price'[Month] ),
            sel_lab = 'Product'[LabName]
        )

    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your feedback.


    Best Regards,
    Henry


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.