I have the following schema :
I am using a live connection to this SSAS Tabular cube, I want to calculate the amount of the Products with Status = Available
for each product comparing to the total amount of Products with Status=Available.
The dax query is like below :
Montant =
VAR MontantA =
CALCULATE (
SUM(FactTable[montant]),
dim_status[labelstatus] = "Available" ,
FactTable[ProductSK] <> -1
)
)
VAR MontantTotal =
CALCULATE (
SUM(FactTable[montant]),
dim_status[labelstatus] = "Available"
)
RETURN
DIVIDE (
MontantA,
MontantTotal
)
I get 1 as a result for all the products.
I think this might get you a bit closer to what you're after:
Montant =
VAR MontantA =
CALCULATE (
SUM ( FactTable[montant] ),
dim_status[labelstatus] = "Available",
KEEPFILTERS ( dim_product[ProductSK] <> -1 )
)
VAR MontantTotal =
CALCULATE (
SUM ( FactTable[montant] ),
dim_status[labelstatus] = "Available",
ALL ( dim_product )
)
RETURN
DIVIDE ( MontantA, MontantTotal )