Nilotpal Choudhury
Nilotpal Choudhury

Reputation: 135

Why is the calculate function giving different results for same expression when written by directly referencing a measure or its components?

I was running a measure wherein I wanted to compare the output of the gasoline product against all other products in a table visual in Power BI. I wrote 2 measures which were intended to give the same results but, they both populated the same numbers but, differently in the visual.

Demand Volume 2 = CALCULATE([Total Volume],filter(Product_Table, \
(Product_Table[Concept]="Demand" || Product_Table[Concept]="Export") && Product_Table[Product]="Gasoline"))

The initial part of the formula was captured under a new measure called Demand Volume

Demand Volume = [Total Volume],filter(Product_Table, \
    (Product_Table[Concept]="Demand" || Product_Table[Concept]="Export") 

And, the new formula Demand Volume 3 was created as follows -

Demand Volume 3 = CALCULATE([Demand Volume],Product_Table[Product]="Gasoline")

I am unable to understand why Demand Volume 2 populates only against gasoline while Demand Volume 3 is able to populate against all rows.

Any help is highly appreciated.

enter image description here

Upvotes: 0

Views: 51

Answers (1)

Shani Noorudeen
Shani Noorudeen

Reputation: 34

It is because you just took the value of Gasoline in the measure Demand Volume 3. You dint use the filter condition on the table.

Please try using the measure as below

Demand Volume 3 = CALCULATE([Demand Volume],FILTER(Product_Table,Product_Table[Product]="Gasoline"))

Upvotes: 1

Related Questions