Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I am looking for API details to create dataset with many to many cardinality relationship between tables.
I have multiple tables and I am able to give BothDirections relationships using API but unable to find any API for cardinality.
Below is API endpoint which I am using to create datasets:
https://api.powerbi.com/v1.0/myorg/groups/{ID}/datasets
Any recommendations please.
TIA.
Hi @Anonymous ,
Are you using the following REST API to create the dataset? According to my research, there is no explicit definition of the cardinality property exactly. I think it may be because power BI intelligently identifies the cardinality between tables based on the data in the tables.
Push Datasets - Datasets PostDatasetInGroup
Please review the blog below to see if you can programmatically define the cardinality value explicitly.
Programming Datasets with the Tabular Object Model (TOM)
model.Relationships.Add(new SingleColumnRelationship {
Name = "Products to Sales",
ToColumn = tableProducts.Columns["ProductId"],
ToCardinality = RelationshipEndCardinality.One,
FromColumn = tableSales.Columns["ProductId"],
FromCardinality = RelationshipEndCardinality.Many
});
Best Regards
Thank you for your response.
I tried same approach but not worked for me.
API Endpoint - https://api.powerbi.com/v1.0/myorg/groups/{ID}/datasets
Below is snippet from request:
{
"fromColumn": "judgeId",
"fromTable": "DocketJudge",
"ToCardinality": "one",
"name": "judgeEducation",
"toColumn": "judgeId",
"toTable": "JudgeEducation",
"FromCardinality": "many",
"crossFilteringBehavior": "bothDirections"
}
It failed with 400 Bad Request error saying "The property 'ToCardinality' does not exist on type 'Microsoft.PowerBI.ServiceContracts.Api.Relationship"
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |