Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Based on a selection I need to get a value for a field that is related to this selection. For instance in the table below the user selects EQUIPMENT ID 3 from a slicer (in yellow below) which happens to be a Model A. I am looking for some help for a DAX expression that would relate the selection of 3 to giving me a count of all Models that are the same as type 3 in this example:
Hi @Anonymous,
Assuming that a Equipment can only have a model associated with it based on your data so you need to create this two measures:
Model Select = IF ( DISTINCTCOUNT ( Equipments[Equipment ID] ) > 1; BLANK (); MAX ( Equipments[Model] ) ) Count Model = CALCULATE ( COUNT ( Equipments[Model] ); FILTER ( ALL ( Equipments[Model]; Equipments[Equipment ID] ); Equipments[Model] = MAX ( Equipments[Model] ) ) )
The first measure returns the model name, if you have more than one value it will return blanks , the second counts the number of equipments similar to the Equipment ID associated.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks for the response!
Couple questions:
1. How do I get "Model Select", a measure, in a Slicer per your example? Measures can't be put in slicers.
2. I apologize but "Model" is in a different table so the ALL function is failing. Is there a way to account for Equipment ID and Model being in different tables?
Hi,
If model is in a different table then what is the lookup value/common column in both datasets. Share both datasets here.
hi,@Zagzebski
After my research, you can do these follow my steps as below:
Step1:
"Model" is in a different table, So create the relationship between them
Step2:
use these two formulas
new Count Model = CALCULATE ( COUNT ( Equipments[EQUIPMENT ID] ),ALL(Equipments[EQUIPMENT ID]), FILTER ( ALL ( Table1[Model],Table1[EQUIPMENT ID] ), Table1[Model] = MAX ( Table1[Model] ) ) )
Result:
when select "EQUIOMENT ID" is 3:
And you only need to drag field model into slicer
when select "model" is A:
here is demo, please try it.
Best Regards,
Lin
Hi @v-lili6-msft,
Redo the measures I made to:
Model Select = IF ( DISTINCTCOUNT ( Equipments[Equipment ID] ) > 1; BLANK (); MAX ( Table1[Model] ) ) Count Model = CALCULATE ( COUNT ( Table1[Model] ); FILTER ( ALL ( Table1[Model]; Table1[EQUIPMENT ID] ); Table1[Model] = MAX ( Table1[Model] ) ) )
See attach your PBIX file with the changes.
Be carefull because of the both side filtering between tables if you are using this tables in other calculations this can change your outcome.
Regards.
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsMarch 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
85 | |
70 | |
68 | |
50 | |
32 |
User | Count |
---|---|
115 | |
100 | |
73 | |
65 | |
40 |