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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
PhilC
Resolver I
Resolver I

Data model advice - data table with fields with multiple values

Am after advice about setting up a data model where there are multiple fields that could have multiple values.

 

Situation is a data (fact) table for publications.  Each publication has a number of attributes which are in the columns.  There are a number of attributes that can have multiple field for a give publication.

 

Examples

  1. Author – for each publication there can be multiple authors.  There are a number of fields that relate to the author, not just one field  (ie Name, Surname, Country, Type)
  2. Organisation – multiple organisations can be attached to a publication.  Single field for this one (Discipline Code)
  3. Field of Research – there can be multiple FORs for a publication.  There are two fields here, FOR Code and Percentage

 

The author / organisation / FOR fields are not related to each other.

 

We have been operating with the fact table at the publication-author level, but now need to report on these other elements.

 

How do I best model the fact table to accommodate these different grains for some fields existing in the data?  The solution needs to be flexible and I expect there to be more fields where there are multiple values going forward (ie hoping not to replicate data for each field needing to be modelled).

 

Have searched but did not locate a similar discussion, please send link if aware of one.

 

Thanks for your thoughts

 

5 REPLIES 5
DataInsights
Super User
Super User

@PhilC,

 

There are multiple ways to create this model. I prefer the approach below, since it avoids bidirectional relationships. As I understand it, the relationship between publications and authors is many-to-many (a publication can have multiple authors, and an author can have multiple publications). The concept is to create an Author Group, and use Author Group Key in your fact table. The table DistinctAuthorGroup is a bridge table that can be created in Power Query or DAX. This pattern can be applied to Organisation and Field of Research.

 

Model:

 

DataInsights_0-1667826091456.png

 

Data:

 

DataInsights_2-1667826297699.png

 

Calculated table:

 

DistinctAuthorGroup = DISTINCT ( AuthorGroup[Author Group Key] )

 

Measure:

 

Total Sales = 
CALCULATE (
    SUM ( FactTable[Sales] ),
    CROSSFILTER ( AuthorGroup[Author Group Key], DistinctAuthorGroup[Author Group Key], BOTH )
)

 

The measure uses CROSSFILTER to enable a bidirectional relationship in the context of the measure.

 

Result:

 

DataInsights_1-1667826228678.png

 

Note that the Author 1 total equals the grand total. This is due to the fact that Author 1 is involved in each publication.





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

Proud to be a Super User!




Thanks @DataInsights 

 

Am digesting this to see if I can implement it.

 

I am not understanding the AuthorGroup table.  I have a unique value for Author.  Where does the Author Group Key in teh Author Group table come from?

 

Thanks

@PhilC,

 

You would have to build the AuthorGroup table, preferably as part of an ETL process. Do you have access to an ETL developer or are you building this from scratch in Power BI?





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

Proud to be a Super User!




v-yiruan-msft
Community Support
Community Support

Hi  @PhilC ,

If I understand correctly, it seems that what you want to get is to get a report which the data is from different tables. And these tables are not related. Please correct me if my understanding is wrong. Could you please provide some sample data of Author, Organisation, Field of Research and the fact table at the publication-author level? Also please share your expected result with backend scenario and the special example. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

 

In addition, please review the following links. Hope they can help you.

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Rena, 

 

I do not think you are understanding the data.  The data is all related to one table - the publication.

 

I cannot really provide a model, because this is what I am asking for assistance on.

 

For example.

 

Publication ID = 1

- this publication has mutiple authors (Peter, Paul, Mary)

- this publication has FOR codes (123 - 50%, 456 - 50%)

- this publication has Departments (Dept A, Dept B, Dept C)

There is no direct relationship between Author and FOR and Department, so having them on the same rows is not necessarily correct.

 

I want to set up the model to have Departments and FORs as lookup tables and be able to filter and slice on them.

I would generally be doing a DISTINCTCOUNT of Pub ID.

There are many other fields (per Pub ID) that I use for different measures too.

 

Hope that helps fill out the picture a bit.  

 

Thanks

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.