Forum Discussion
Anonymous
5 years agoNot applicable
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 ...
- 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" )RETURNCALCULATE ( [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" ))
Anonymous
5 years agoNot applicable
Hello Jihwan,
Thanks for your response. However I am unable to download the Attached PBI file due to compatibilty issues,
Would It be possible for you to share the DAX of the KPI that the file has please.
Thanks
AP
Jihwan_Kim
5 years agoSuper User
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" )
)
- Anonymous5 years agoNot applicable
Hello Jihwan,
Thanks for the help. This worked 🙂