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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello,
I'm new in Power BI. My question is if you can use a measure as a function with parameters.
We have several measures with the same structure like:
Sum of Cars =
var _NumberofItems = count(Car_ID)
var _NumberofUnvalidItems = CALCULATE(Count(Car_ID), 'Test'[Status] = "20000", ALLSELECTED())
var _NumberofNextItems = CALCULATE(Count(Car_ID), 'Next'[Status] = "90000", ALLSELECTED())
return _NumberofItems - _NumberofUnvalidItems + _NumberofNextItems
Our problem is that we have Cars, Motorbikes, Bikes, Vans.... and always the same measure structure.
Is it possible to use something like this:
SumofItems=
var _NumberofItems = count(<ITEM_ID>)
var _NumberofUnvalidItems = CALCULATE(Count(<ITEM_ID>), 'Test'[Status] = "20000", ALLSELECTED())
var _NumberofNextItems = CALCULATE(Count(<ITEM_ID>), 'Next'[Status] = "90000", ALLSELECTED())
return _NumberofItems - _NumberofUnvalidItems + _NumberofNextItems and then call the function in a new measure:
Sum of Cars = SumofItems(Car_ID)
Sum of Bikes = SumofItems(Bike_ID)
If something changes, i only have to change the measure SumofItems.
Thank you!
Solved! Go to Solution.
Read about Calculation Groups.
| User | Count |
|---|---|
| 24 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |