Forum Discussion

joshua1990's avatar
joshua1990
Post Prodigy
3 years ago
Solved

Structure with multiple dimension tables

Hi all!

I need a bit support regarding my data model.

I have 1 table (Article) that contains all articles. 1 row per article:

Article Group A Group B
Bike AB 1
Chair BB 2

 

Then I have a order master table with 1 row per order. Both tables are linked by column Article:

Order NR Article Value Cost
1 Bike 500 600
2 Bike 500 600

 

Then I have a second table (Routing) with dimensions. This table shows me the process steps that have to be completed:

Article Process Nr Description
Bike 1 Assemble
Bike 2 Drill
Bike 3 Mount

This table is linked with the first table (Article) using column Article. The Process Nr column is not unique. THere could be a duplicate in a different article.

And then I have a second transaction table (Transaction) that shows me the actual process steps for each order:

Order Nr Article Process
1 Bike 1
1 Bike 2
1 Bike 3

It has multiple rows per order. For each started process we can find a row. Not started process steps are not shows here.

This table is linked via Order Nr with the Order Master Table.

 

Now I would like to create a Matrix that shows me this:

Group A Article Assemble Mount
AB Bike 1 1
AB Bike 1 0
AB Bike 0 0

 

This matrix should show if a process steps has started or not. COUNTROWS in table Transaction.

Group A and Article are from table Article. Columns (Process) are from Routing.

But if I pull any value from table Transaction then I always get an error:

cannot display the data because power bi can't determine the relationship

 

What is the issue here? How would you build the data model?

Do I need a unique table with all Processes?

 

  • Hi , joshua1990 

    According to your description, i test it with the data you provided.

    Here are the steps you cna refer to:

    (1)My test data is like yours, and this is the relationship between the tables:

    (2)We can create a measure :

    Measure = var _cur_process  =SELECTEDVALUE('Routing'[Process Nr])
    var _t =FILTER( 'Transaction', 'Transaction'[Process]=_cur_process)
    return
    COUNTROWS(_t)

    (3)Then we put the field we need in the matrix, and we will meet your need:

    If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

     

4 Replies

  • Hi , joshua1990 

    According to your description, i test it with the data you provided.

    Here are the steps you cna refer to:

    (1)My test data is like yours, and this is the relationship between the tables:

    (2)We can create a measure :

    Measure = var _cur_process  =SELECTEDVALUE('Routing'[Process Nr])
    var _t =FILTER( 'Transaction', 'Transaction'[Process]=_cur_process)
    return
    COUNTROWS(_t)

    (3)Then we put the field we need in the matrix, and we will meet your need:

    If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

     

    • joshua1990's avatar
      joshua1990
      Post Prodigy

      v-yueyunzh-msft : Thanks a lot! That works. 

      Another question: What if I select two Articles with 2 different process nrs. All process nrs will be display with values for each article. But I would like to get the text "NA", if a process nr is not part of an article.

      How would you do that?

      • v-yueyunzh-msft's avatar
        v-yueyunzh-msft
        Community Support

        Hi , joshua1990 

        You can try this dax :

        Measure = var _cur_process  =SELECTEDVALUE('Routing'[Process Nr])
        var _t =FILTER( 'Transaction', 'Transaction'[Process]=_cur_process)
        return
        IF(COUNTROWS(_t)=BLANK(),"NA",COUNTROWS(_t))

        The result is as follows:

        Best Regards,

        Aniya Zhang

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly