Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Can a Field Parameter DAX expert help me please.
How can Field Parameters be used in DAX measures?
Click here to download example PBIX from Onedrive
In the attached PBIX I have crated a fictional example for a pet shop
There is a Field Parameter for types (Vet, Pet type and Colour)
and Field Parameter for metrics (Cost, Sales, Profit and Tax)
The green card = the field parameter “Metrics[Metrics Value]”.
The Row count = the number of rows.
I want the bottom card to show the average but the DAX syntax won’t allow the Field Parameter highlighted in red
Average =
DIVIDE(
Metrics[Metrics Value],[Row count)
Please can you suggest a method of calculating the average of the Field Parameter without creating a separate formula for cost, sales, profit and tax.
Please create an working example by downloading the above attached PBIX.
Thank you.
Try this measure:
Average =
VAR vSelectedMetric =
SWITCH (
MAX ( Metrics[Metrics Value] ),
"Costs", [Costs],
"Sales", [Sales],
"Profit", [Profit],
"Tax", [Tax]
)
VAR vResult =
DIVIDE ( vSelectedMetric, [Row count] )
RETURN
vResult
Proud to be a Super User!
Thank you very much for replying and going to the effort of writing a DAX script.
Your answer is a work arround.
However, it does not answer the question how to reference Field Paraneters in DAX measures.
Does anyone know the answer please?
User | Count |
---|---|
77 | |
77 | |
68 | |
67 | |
49 |
User | Count |
---|---|
108 | |
104 | |
93 | |
83 | |
64 |