Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi - I have a couple of measures that I compare against each other to get another measure - I'd like to be able to put all 3 of them into one longer DAX measure, is that possible?? Is there a more elegant way of doing everything in one? I have:
WEEK 31 Total Products =
CALCULATE(
COUNTROWS ('Combined_GPI'),
FILTER('Combined_GPI','Combined_GPI'[Week] = 31)
)
and
WEEK 31 Out of Stock =
CALCULATE(
COUNTROWS ('Combined_GPI'),
FILTER('Combined_GPI','Combined_GPI'[OOS] = 1),
FILTER('Combined_GPI','Combined_GPI'[Week] = 31)
)
which I then use to get
WEEK 31 AVAILABILITY =
1 - DIVIDE(('Combined_GPI'[WEEK 31 Out of Stock]), ('Combined_GPI'[WEEK 31 Total Products]))
Any help greatly appreciated!
Dan 🙂
Solved! Go to Solution.
@Anonymous Try:
WEEK 31 AVAILABILITY =
VAR __WEEK31TotalProducts =
CALCULATE(
COUNTROWS ('Combined_GPI'),
FILTER('Combined_GPI','Combined_GPI'[Week] = 31)
)
VAR __WEEK31OutofStock =
CALCULATE(
COUNTROWS ('Combined_GPI'),
FILTER('Combined_GPI','Combined_GPI'[OOS] = 1),
FILTER('Combined_GPI','Combined_GPI'[Week] = 31)
)
RETURN
1 - DIVIDE(('Combined_GPI'[__WEEK31OutofStock]), ('Combined_GPI'[__WEEK31TotalProducts]))
@Anonymous Try:
WEEK 31 AVAILABILITY =
VAR __WEEK31TotalProducts =
CALCULATE(
COUNTROWS ('Combined_GPI'),
FILTER('Combined_GPI','Combined_GPI'[Week] = 31)
)
VAR __WEEK31OutofStock =
CALCULATE(
COUNTROWS ('Combined_GPI'),
FILTER('Combined_GPI','Combined_GPI'[OOS] = 1),
FILTER('Combined_GPI','Combined_GPI'[Week] = 31)
)
RETURN
1 - DIVIDE(('Combined_GPI'[__WEEK31OutofStock]), ('Combined_GPI'[__WEEK31TotalProducts]))
Thanks @Greg_Deckler - thats super helpful! I'll do some learning on Variables 🙂
Hi there! In this case you can make use of variables inside of a single measure. For example, in your case ot could be:
WEEK 31 AVAILABILITY =
var WEEK_31_Total_Products =
CALCULATE(
COUNTROWS ('Combined_GPI'),
FILTER('Combined_GPI','Combined_GPI'[Week] = 31)
)
var WEEK_31_Out_of_Stock =
CALCULATE(
COUNTROWS ('Combined_GPI'),
FILTER('Combined_GPI','Combined_GPI'[OOS] = 1),
FILTER('Combined_GPI','Combined_GPI'[Week] = 31)
)
return
CALCULATE(
1 - DIVIDE(WEEK_31_Out_of_Stock, WEEK_31_Total_Products)
)
Hope this solves your problem! If you need additional help please tag me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!
Best regards,
Gonçalo Geraldes