Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi all,
I ran into a problem recently and hope that someone knows what I am doing wrong:
I have two data sets which are mapped by an ID.
The element dataset looks like this:
element | summary_ID | finish date | element type |
a | 1 | 23.09.21 | Type 1 |
b | 1 | 22.09.21 | Type 2 |
c | 2 | 21.09.21 | ... |
Summary dataset looks like this:
ID | Summary Finish Date (see below) |
1 | ... |
2 | ... |
I am calculating the Summary Finish Date as the last finish date of all included elements using this formular:
Summary Finish Date = CALCULATE(
MAX(element[finish date]),
FILTER(element, element[summary_ID] = summary[ID]))
Afterwards I pulled in "ID" and "Summary Finish Date" both from the summary dataset into a table on a PowerBI dashboard. On the same dashboard I also included a filter by "element type" from the element dataset.
Unfortunately, that filter does not do anything for me. When I filter for Type 2 the displayed date will still be 23.09.21 for ID 1.
Only if I include the filter into the calculated column directly it works:
Summary Finish Date = CALCULATE(
MAX(element[finish date]),
FILTER(element, element[summary_ID] = summary[ID] && element[element type] = "Type 2"))
The result now is 22.09.21 - As expected.
Any idea what I have to do to get the variable filter to work?
Thanks,
David
@david_blabla if I understand it correctly,
you created 'Summary Finish Date' calculated column in 'summary'
and
in your data model 'summary' filters 'element' in 1 to Many.
In the viz, you brought all your AXIS (columns) from 'summary' and expects that Viz to be sliced by an element (element type) from 'element'.
Since 'element' does not filter 'summary' that slicer would not work.
In order to make it work,
you can build an 'element type' table and connect it to 'element'
and
write a measure
and
bring your AXIS from both 'summary' and 'element type' table
and
bring slicers from all the dimension tables ('summary','elemnt type')
@david_blabla I am guessing your DM looks like this
The flow of filter (arrow) is from summary to element, which means only columns from summary can slice anything from element, summary can slice summary. But element can't slice sumamry unless you make the filter bi-directional (which is not recommended) but then it introduces a lot of ambiguity in the model.
What I have suggested is this. When building viz, bring all the axis and slicers from from 'elementType' and 'summary'; create a measure on 'element' and drop that on the axis. Slicer can easily slice them.
@david_blabla , we can not use slicer values in a calculated column. We need to work with measure only
Hi @amitchandak, I can not believe that is true as on other pages I have pulled calculated columns into tables as well and the displayed data get's filtered based on the slicers.
@david_blabla , a measure can use slicer value. Not the column, that is what I know. Can you share a sample pbix after removing sensitive data.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
112 | |
89 | |
82 | |
76 | |
64 |
User | Count |
---|---|
143 | |
111 | |
108 | |
99 | |
95 |