Forum Discussion

UBOIS81's avatar
UBOIS81
Regular Visitor
3 years ago

Get category based on measure

Hello, I have a measure that calculates the minimum price per product (see below).

 

Meilleur_Prix_Historique =
CALCULATE (
    MIN ( Rabais[Prix] ),
    ALLEXCEPT ( Rabais, Rabais[Produit], Rabais[Marque], Rabais[Format] )
)

 

I'm trying to get the "Magasin" value for this measure. In this case I would have "Familiprix" appearing for each line.

 

Thank you

 

2 Replies

  • rsbin's avatar
    rsbin
    Icon for Community Champion rankCommunity Champion

    UBOIS81 ,

    You can try something like this:

    Magasin_Prix_Historique = CALCULATE( MAX( [Magasin] ), Filter( Rabais, [Prix] = [Meilleur_Prix_Historique] ))
    Marque Produit Magasin Prix Meilleur_Prix_Historique Magasin_Prix_Historique
    L'oreal abc FamilyPrix 11.99 11.99 FamilyPrix
    L'oreal abc PharmaPrix 25.99 11.99 FamilyPrix

    However, you may run into an issue when there are multiple Magasins with the same Prix.  In that case, you may need to add in some additional functionality to the basic calculated column provided above.

    Hope this gets you started.

    Regards,

    • UBOIS81's avatar
      UBOIS81
      Regular Visitor

      Hello, yes indeed. I had already tried that and it is not working.

       

      Thank you