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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rajanimaddala
Helper II
Helper II

Suggest the data model for my data

Hi mates,

I need to create a dashboard for sales.

I have different tables in the database to hold sales for different products. Each comes from different systems.

There is no direct relationship between these. For example, particular product sales value is calculated by SUM(value from table1 and value from table2 - value from table3)

I can create a UNION query to get the aggregated value but I need to show the underlying data when the users clicks on Show Data.

Columns in all the tables are not same.

I am struggling to create a data model for this. Any suggestion please

Regards

1 ACCEPTED SOLUTION

@rajanimaddala 

 

In such cases, I usually create a simple table of unique products and then link it with Product and Target. This table then will act as filter table and you can use it in your visuals and DAX.

 

So you will have two filter tables: Product(Unique) & Calendar/Date table

 

And you will have two fact tables: Performance Data and Target Data

 

There will be a Many-to-One relationship between fact and filter tables and then you can write your DAX suitable to your need. You can use RELATED function to filter the facts table.

 

Hope this should help.

 

Rgds,

Vivek

 

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

View solution in original post

7 REPLIES 7
v-chuncz-msft
Community Support
Community Support

@rajanimaddala 

 

You may take advantage of 

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

Hi

Thanks for the reply.

Let me explain my model

I have 3 tables

1. Sales (Product, Transaction_Date, Sales_Amount)

2. Targets(Product, Transaction_Date(last day of month), Target_Value)

3. Date(Date, FY, Qrtr, MonthName, Year)

 

I have created relationship (filter direction = Both)from Sales to Date and Targets to Date(Filter direction=Both)

I am just showing the data in a table like ProductName, MonthName, Year, Sales_Amount, Target_Value

Everything is fine with Sales but Targets are aggregated to whole products

Example,

ProductSalesTargetActual Target
Cycles8700010000070000
Bikes2500010000015000
Cars4000010000015000
 152000100000100000

 

Why am I not getting correct Target value?

Cheers

@rajanimaddala 

 

Hi,

 

The relationship between Target and Sales table is missing hence you are not getting the filtered values for Target.

 

Also, in my experience, single filter direction works more effeciently. Ideally, you will use Date table to filter the Sales and Target table and not vice versa.

 

Rgds,

Vivek

 

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

Hi

Thank you for the reply.

 

I've changed the filter direction to single from Sales to Date and Date to Target

 

Actually, there is no direct relationship between Sales and Targets unless Product. But, it should be Many-to-Many

 

I am confused how to create measure to get the trget value.

If I directly pull Target_Value from Targets table and Product and Sales_Amount from Sales table, I am getting the target_value as explained in my previous post.

Do I need to write DAX expression for Target_Value? If so, in which table I need to create measure?

What could be the DAX expression?

Please advise me

Cheers

 

@rajanimaddala 

 

Hi,

 

Has this been resolved?

 

Rgds,

Vivek

Hi Vivek,

 

   Yes, it worked.

 

Thanks

 

@rajanimaddala 

 

In such cases, I usually create a simple table of unique products and then link it with Product and Target. This table then will act as filter table and you can use it in your visuals and DAX.

 

So you will have two filter tables: Product(Unique) & Calendar/Date table

 

And you will have two fact tables: Performance Data and Target Data

 

There will be a Many-to-One relationship between fact and filter tables and then you can write your DAX suitable to your need. You can use RELATED function to filter the facts table.

 

Hope this should help.

 

Rgds,

Vivek

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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