Forum Discussion
Anonymous
2 years agoNot applicable
Data modeling - create a relationship and filter a dimension
Hi, I have an issue that I can't wrap my head around regarding the relationship between a dimension table and a fact table. Background: We have a data model with a star schema structure. Let's ma...
- 2 years ago
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
Sales: = VAR _ProductByMarkdownTypeByDate = SUMMARIZE ( GENERATE ( markdown, FILTER ( 'calendar', 'calendar'[Date] >= markdown[markdown_startdate] && 'calendar'[Date] <= markdown[markdown_enddate] ) ), markdown[article_id], 'calendar'[Date] ) RETURN IF ( ISFILTERED ( markdown_type[markdown_type] ), CALCULATE ( SUM ( sales[sales_amount] ), TREATAS ( _ProductByMarkdownTypeByDate, 'product'[article_id], 'calendar'[Date] ) ), SUM ( sales[sales_amount] ) )
Jihwan_Kim
Super User
2 years agoHi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
Sales: =
VAR _ProductByMarkdownTypeByDate =
SUMMARIZE (
GENERATE (
markdown,
FILTER (
'calendar',
'calendar'[Date] >= markdown[markdown_startdate]
&& 'calendar'[Date] <= markdown[markdown_enddate]
)
),
markdown[article_id],
'calendar'[Date]
)
RETURN
IF (
ISFILTERED ( markdown_type[markdown_type] ),
CALCULATE (
SUM ( sales[sales_amount] ),
TREATAS (
_ProductByMarkdownTypeByDate,
'product'[article_id],
'calendar'[Date]
)
),
SUM ( sales[sales_amount] )
)
Anonymous
2 years agoNot applicable
Wow Jihwan_Kim , this is really the solution that I need! Thanks A LOT!