cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
emily_george_11
Regular Visitor

DAX to Return Column Value when there is no primary key but will only be based on Dates

Hi, I've been spending weeks trying to figure this out, hoping you could help me.

In my PBI, I have 2 tables - one is the class_tbl(dojo table) and the roster. I am trying to get the "wave" of a user if the date in roster is between the training start and end dates. And for the remaining dates in the roster will be the wave where the user attended the last training.

 

I used LASTNONBLANK but it only returned the first 2 waves.

 

There are multiple IDs that have this case, but this ID is one example. 

 

Here is my DAX:

wave_no_K =
    CALCULATE (
        LASTNONBLANK(dojo_test_tbl[wave_number], 1),
        FILTER (
            ALL (dojo_test_tbl),
            dojo_test_tbl[eid] = EPMS_Roster[employee_id]
            && dojo_test_tbl[wave_type]="NES" && dojo_test_tbl[wave_final_end_date]<EPMS_Roster[date_extracted]
               
        ))

 

Here the Dojo or Class Table look likes

emily_george_11_4-1685581481664.png

 

Roster 

The 2/27/2023 date onwards should return wave 8C but it shows Cross-Skill 3A. The wave 8C is completely not captured.

emily_george_11_3-1685581409657.png

 

emily_george_11_5-1685581669644.png

 

Thank you so much!

 

 

 

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @emily_george_11 ,

 

What does your wave_type mean? Should I consider it when calculating?

Sorry for that the information you have provided is not making the problem clear to me. Can you please share more details to help us clarify your scenario?

 

Best Regards,

Jianbo Li

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

 

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors