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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Help with DAX Variables

I have 3 formulas 

 

Total = (CALCULATE('Sales'[x], 'Customers'[Markets]="All of US"))

 

CustomSales = (CALCULATE(SWITCH(

SELECTEDVALUE('Customers'[Total US Markets]),

"Retailer 4",

CALCULATE([x],'ITEM Control'[Control Item] = "P"),

CALCULATE([$]))))

 

 

 

SUMX (
VALUES ( 'Customers'[Markets]),
DIVIDE (
CustomSales,
CALCULATE ( Total, All('Customers'[Markets] )
) * 100
))



Trying to consolidate into 1 with variables, but I've ran into issues. They work on their own if each one was individual, but in this, I'm having issues :

 

 

 

biglostenergy_0-1667484199776.png

 

 

3 REPLIES 3
v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

Depending on your dax, one thing to clarify is whether all three of you are Measure and there are no computed columns?New columns cannot be defined directly in a measure.

Then, if they are all measures, check if there is a problem with the returned values if all 3 measures are placed on the visual.

For your problem, it's hard to see the problem without combining the data.

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

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

Anonymous
Not applicable

These are all measures, each specific variable is a measure already and that second part with the sumx is a measure but I'm trying to combine it all into one thing with one chunk of dax text. 

Hi, @Anonymous 

You can try to split the measure and placing each of the 3 measures in the visual to see if an error is reported.

In addition, would you like to share your .pbix file (remove sensitive data) so that we can help you better, or provide the corresponding sample data and table relationships in the form of a table?

 

Best Regards,

Aniya Zhang

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.