-2

I have the following schema :

enter image description here

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.

Amira Bedhiafi
  • 8,088
  • 6
  • 24
  • 60

1 Answers1

2

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 )
Alexis Olson
  • 38,724
  • 7
  • 42
  • 64