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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
afbraga66
Helper III
Helper III

Custom total value for measure

Hi,

I'm trying to get a specific total value, but I'm not sure how can I achieve it.

So I've got two variables "Densidade" and "FX Quimicos". The way my deviation formula works, I can get the total for one or the other, depending on which is being filtered on the slicer. The thing is I want the total also when both are being selected, but the total needs to be the sum of the individual values of each variable. Example below: File: https://we.tl/t-i40oiGDkRJ

 

My total for "Densidade" deviation is -1,11%:

afbraga66_1-1701855256987.png

My total for "FX Quimicos" deviation is -0,11%:

afbraga66_2-1701855307006.png

My total value of both variables should be -1,11% + (- 0,10%) = -1,21%

afbraga66_3-1701855356180.png

I have not been able to get that total of the both variables. Tried summarize but still not working.

Could you please help me in this?

Thank you

 

Best regards,

André

1 ACCEPTED SOLUTION
123abc
Resident Rockstar
Resident Rockstar

  1. Create Individual Deviation Measures:

    • Ensure you have separate measures for "Densidade" deviation and "FX Quimicos" deviation.
  2. Create a New Measure for Total:

    • Create a new measure for the combined deviation. You can use a formula like this:

Total Deviation = [Densidade Deviation] + [FX Quimicos Deviation]

 

  1. Display Total Deviation in Visuals:

    • Use the "Total Deviation" measure in your visuals. It should now correctly display the sum of individual deviations when both "Densidade" and "FX Quimicos" are selected.
  2. Handle Slicer Interaction:

    • Make sure that your measures are not affected by slicer interactions if you want to see the total regardless of the slicer selections. You can use functions like ALL or ALLSELECTED to remove any slicer context when calculating the total.

Here's an example of how you might adjust your measure to handle slicer interactions:

 

Total Deviation =
CALCULATE(
[Densidade Deviation] + [FX Quimicos Deviation],
ALL('YourTableName'[YourSlicerField])
)

 

Replace 'YourTableName' and 'YourSlicerField' with the appropriate table and field names.

Remember that DAX measures should reflect the logic you want in your visualizations. Adjust the calculations based on your specific data model and requirements.

If you encounter specific issues or have more details to provide, feel free to share the relevant parts of your DAX code or describe the issue, and I'll do my best to assist you.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @afbraga66 ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
afbraga66
Helper III
Helper III

Hey, not sure why is this happening but my post was marked as spam.

Here is the original link: https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-total-value-for-measure/m-p/3...

 

If someone could help I would appreciate.

Thank you.

Best regards,

André

123abc
Resident Rockstar
Resident Rockstar

  1. Create Individual Deviation Measures:

    • Ensure you have separate measures for "Densidade" deviation and "FX Quimicos" deviation.
  2. Create a New Measure for Total:

    • Create a new measure for the combined deviation. You can use a formula like this:

Total Deviation = [Densidade Deviation] + [FX Quimicos Deviation]

 

  1. Display Total Deviation in Visuals:

    • Use the "Total Deviation" measure in your visuals. It should now correctly display the sum of individual deviations when both "Densidade" and "FX Quimicos" are selected.
  2. Handle Slicer Interaction:

    • Make sure that your measures are not affected by slicer interactions if you want to see the total regardless of the slicer selections. You can use functions like ALL or ALLSELECTED to remove any slicer context when calculating the total.

Here's an example of how you might adjust your measure to handle slicer interactions:

 

Total Deviation =
CALCULATE(
[Densidade Deviation] + [FX Quimicos Deviation],
ALL('YourTableName'[YourSlicerField])
)

 

Replace 'YourTableName' and 'YourSlicerField' with the appropriate table and field names.

Remember that DAX measures should reflect the logic you want in your visualizations. Adjust the calculations based on your specific data model and requirements.

If you encounter specific issues or have more details to provide, feel free to share the relevant parts of your DAX code or describe the issue, and I'll do my best to assist you.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors