Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Measures - sum * Not sum

Hi All,

 

I have a problem with counting in measures.

 

I have two printouts with the same name, the number of printed pages is the same, the cost per page is e.g. 0.08
The query gives the result
day name number of pages cost

Day

Name

Number of Pages

cost pages

1

xxxx

4

0.08

3

xxxx

4

0.08

 

In the table in the Power Bi Desktop

I create tables

Name number cost per pages total cost

Name

Number of Pages

Cost of pages

TotalCost

xxxx

8

0,08

?????

 

I creat measures

TotalCost = CALCULATE(sum(query[pages])*sum(Query[costs_per_page])) is wrong sum pages and cost, when I want calculate 
TotalCost = CALCULATE(sum(query[pages])*Query[costs_per_page]) I get error

 

How to filtred or calculated? 

 

  • Hi Anonymous 

    Try this

    TotalCost = CALCULATE( sum(query[pages]) * MIN(Query[costs_per_page]) )

    Regards

    Phil

2 Replies

  • Hi Anonymous 

    Try this

    TotalCost = CALCULATE( sum(query[pages]) * MIN(Query[costs_per_page]) )

    Regards

    Phil