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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Blaenzo
Advocate II
Advocate II

Determine which conditions are met in capabilities.json and read values by datarole name

Hi,

 

Assume I have the following two conditions specified in capabilities.json below.

  1. What is the proper way to determine which of the two conditions is satisfied (or none)?
  2. Is there a way to retrieve the values of a field (from options.dataView) by its data role name rather than by an index?
"conditions": [
	{
		"ltd": {
			"min": 1,
			"max": 1
		},
		"lng": {
			"min": 1,
			"max": 1
		},
		"zip": {
			"max":0
		}
	}
]

and

"conditions": [
	{
		"ltd": {
			"max": 0
		},
		"lng": {
			"max": 0
		},
		"zip": {
			"min": 1,
			"max": 1
		}
	}
]

Thanks,

Martijn

 

 

 

 

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @Blaenzo - for question #2, we had a similar post the other day - does this response cover-off your question? If not, let me know and I'll see if I can help fill in any gaps.

Good luck,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

3 REPLIES 3
dm-p
Super User
Super User

Hi @Blaenzo - for question #2, we had a similar post the other day - does this response cover-off your question? If not, let me know and I'll see if I can help fill in any gaps.

Good luck,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Hi @dm-p ,

 

Yes, that worked. Thanks very much.

The filter statement also works nicely with data roles that accept multiple fields as it returns an array of all fields.

From here you can indeed work out which conditions have been met.

 

Thanks,

Martijn

The code linked in the previous answer also shows my approach to 'testing' for conditions once I get the column metadata, which may help with solving question #1 - if you have multiple conditions, then you can create flags to indicate suitable scenarios and perhaps branch on those using a switch statement or simialr, depending on the complexity of your view model.

If you need further advice, let me know and I'll try and mock something up when I get back into the office next week. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.