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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
hrafnkel11
Helper I
Helper I

Calculated Column Ignoring Slicer Selection

Happy Friday!

 

I am having issues with a calculated column where I have a people table and need to bring in the total passed tests for each person from another table. I’m trying to do this as a calculated column, because there are multiple types of tests and I need to run a conditional column across them to determine final results for each person.

 

The complication I am having is that the person table is a snapshot that has one person record per “as of date”. Because of this, I have one date table governing the people and a separate date table governing the tests (since when someone took a test is irrespective of which “as of date” someone chooses). I need a user to be able to choose the as of date for the people population, as well as the date range for when tests were completed.

 

This is the calculated column I’m having trouble adding to the PERSON table. I’ve tried multiple versions of this and either get ALL tests regardless of which test date is selected or in the case of the below, I get partial data (very limited number of records, all correct, but everything else blank).

 

I feel like I’m missing something elementary here, so any help would be massively appreciated. Thanks!

 

 

 

_Test_Type_1_Passes = 
var _startdate = min('TEST DATE'[DATE])
var _enddate = max('TEST DATE'[DATE])
return
CALCULATE(
    COUNTROWS(
        FILTER('Test Data',
        'Test Data'[Result]="Pass" &&
        'Test Data'[Type]= "1" &&
        selectedvalue('Test Data'[Date]) >= _startdate && 
        selectedvalue('Test Data'[Date]) <= _enddate
    )))

 

 

 

I have a feeling it's due to how my model is set up, but I hesitate changing it if possible, since this is part of a much wider report. Here's a simplified model:

 

hrafnkel11_0-1679066764780.png

 

Expected result in person table:

PersonTest_Type_1_PassesTest_Type_2_PassesTest_Type_3_Passes
John301
Sally521
Anders100
1 ACCEPTED SOLUTION
hrafnkel11
Helper I
Helper I

Update: I've gotten this to work by abandoning the calculated column and just using a measure. I feel like this is usually the answer every time I have a problem with a calculated column.

View solution in original post

1 REPLY 1
hrafnkel11
Helper I
Helper I

Update: I've gotten this to work by abandoning the calculated column and just using a measure. I feel like this is usually the answer every time I have a problem with a calculated column.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors