Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
373 views
in Technique[技术] by (71.8m points)

powerbi - Power BI Visual Level Filter Skewing Measure

In my current data model, I am training to avoid using bidirectional relationships if at all possible.

In order for my lookup tables to interact and filter each other, I have been using a KPI as a visual level indicator.

Basically if this KPI is greater than 0, it means that data exists.

This has worked perfectly on slicers, but on other visualizations it still shows all possible fields unless I manually select the items in the slicers.

The problem I am running into is that I have a function that gives a daily average workload based on planned working days. These are indicated by a '1' on the Date table.

While normally this works fine, when using a KPI for a visual level filter it is also impacting another measure that is using the dates from my calendar table.

In particular on drill down is where I am getting stuck.

Avg. Daily Workday Runtime = 
DIVIDE( 
    SUMX(
        efficiency_records,
        efficiency_records[Runtime] * related('Calendar'[Binary Working Days])
    ),
    CALCULATE(
        sum('Calendar'[Binary Working Days])
    )
) / 60

The above measure takes the number of days that qualify as planned working days (1 or 0 column next to date) to give the average runtime per planned workday.

The issue is that if I add a filter to only show items that have records, this measure then only looks at the days the specific machine ran, rather than all days in the selected time period.

Adding an allexcept('Calendar', 'Calendar['Date']) seemed to work at first, but if I drilldown on a part or machine then the date table is still getting filtered. As a result, while the true number of working days in the selected range is '11' let's say, it ends up as '2' for a selected machine because it only ran for 2 days.

I feel like there has to be some combination of filters to get around this, but have had a hard time finding the right combination.

Any advice would be appreciated.

question from:https://stackoverflow.com/questions/65892635/power-bi-visual-level-filter-skewing-measure

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Problem was that I had a secondary measure based on a different table that was showing regardless of what was happening. By applying the filter to that measure instead of the visual itself everything works as intended.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...