Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Z_BI
Frequent Visitor

Wrong calculate formula DAX measure

HI there,

I’m creating report and I have a problem. When I select a specific year (example 2020), the totals are not right (example below, this is export in excel from power bi service)

Z_BI_0-1648114831147.png

The problem is related to the 3 measures that do not calculate the correct result (first row Highlighted in red)

The result in Matrix Object should be as row highlighted in “blue” and the actual results is highlighted in “yellow”.

These are 3 formulas to calculate measures:

 

COSTO DEL VENDUTO = sum('Costo Medio Ponderato'[COSTO MEDIO PONDERATO]) * SUM(ValueEntryVendite[Quantità Venduta])

 

% COSTO DEL VENDUTO =

VAR sales_amount = sum(ValueEntryVendite[Sales Amount (Actual)])

VAR costo_venduto = [COSTO DEL VENDUTO]

RETURN

(sales_amount-costo_venduto)/sales_amount

 

MARGINE SUL COSTO DEL VENDUTO = SUM(ValueEntryVendite[Sales Amount (Actual)]) - [COSTO DEL VENDUTO]

 

Can you help me please?

4 REPLIES 4
v-xiaotang
Community Support
Community Support

Hi @Z_BI 

Thanks for reaching out to us.

With info above is not enough to go on... Could you share some sample data? so that I can test the measure. Thanks.

usually information below is needed, could you provide it? Thanks.

 (1) a sample file, you can replace raw data with bogus data to protect your privacy.

     or provide some sample data that fully covers your issue/question.

(2) give your expected result based on the sample you provide. If calculation formula is involved, please provide it.

Kindly note: Please ensure the data in sample is concise and representative.

Thanks.

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

davehus
Memorable Member
Memorable Member

Hi @Z_BI , Sorry I was assuming your model was a specific way.

 

Could you give me some context on what is being multiplied here? As I can figured it from the language. 🙂 

 

davehus
Memorable Member
Memorable Member

Hi @Z_BI ,

 

Can you change the first measure to Sumx

 

COSTO DEL VENDUTO = sumx('Costo Medio Ponderato','Costo Medio Ponderato'[COSTO MEDIO PONDERATO]) * Related(ValueEntryVendite[Quantità Venduta]))

 

See if that works.

Z_BI
Frequent Visitor

hi @davehus thanxto reply

Somthing's wrong if apply that formula

Z_BI_0-1648117792809.png

But I have this reletionship

Z_BI_1-1648117884100.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.