Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Need help with DAX

Hello Experts,   I am new to Power BI DAX and still finding my feet. I am looking some help in creating a DAX for the below Requirment-       Product 1  Product 2 Product 3 Total  Rev ...
  • Jihwan_Kim's avatar
    Jihwan_Kim
    5 years ago

    Hi,

    I am not sure that how writing the measures here would help without opening & seeing the sample pbix file.

    I tried to screen capture all the related information in order to make the below measures possibly work.

     

     

    Rev total : =
    SUM(Sales[Rev])
     
    Rev total for customers both P1 & P2 : =
    VAR _product1 =
    CALCULATE ( [Rev total :], Products[Product] = "Product 1" )
    VAR _product2 =
    CALCULATE ( [Rev total :], Products[Product] = "Product 2" )
    RETURN
    CALCULATE ( [Rev total :], FILTER ( Sales, _product1 <> 0 && _product2 <> 0 ) )
     
    Rev P1 & P2 total fix : =
    SUMX(VALUES(Customers[Customer]), [Rev total for customers both P1 & P2 :])
     
    Final Cal : =
    DIVIDE (
    CALCULATE ( [Rev P1 & P2 total fix :], Products[Product] = "Product 1" ),
    CALCULATE ( [Rev P1 & P2 total fix :], Products[Product] = "Product 2" )
    )