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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Choosing corresponding value from particular column based on given criteria

screenshot_data.JPG
I have the above model in my Power BI Desktop file and I am trying to do the following -

I have calculated the Version where the cummulative_version_adoption reaches atleast 50 percent for the first time(>=0.5) through the following measure.
Version_Rolled_Down = CALCULATE(LASTNONBLANK(Query1[Version],1),Query1[cummulative_version_adoption]>=0.5)
which gives me 97333.

Similarly, I am trying to calculate the Version_release_date of the Version where the cummulative_version_adoption reaches atleast 50 percent for the first time i.e., (>=0.5). If the corresponding version has date, then it needs to return that date or else "Date NA".
So from above, I would be picking up 13/08/2014.
But I am not able to do so for the dates as you can see I do not have dates available for every version and also lastnonblank requires me to have all the dates for the versions and also them to be in proper descending order.

It would be really helpful if someone can help me out on this.
Thank You.

Regards,

Sudhamshu

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

Perhaps something along these lines:

 

MyDate = VAR VersionNum = CALCULATE(LASTNONBLANK(Query1[Version],1),Query1[cummulative_version_adoption]>=0.5)

VAR VersionDate = CALCULATE(MIN([Version_Release_Date]),Query1[Version] = VersionNum)

RETURN

IF(ISBLANK(VersionDate),"Date NA",VersionNum)

This assumes that Version_Release_Date is text, if it is an actual DATE value you will probably have to convert it to the text representation of the date. You can do that with a CONCATENATE of the Version_Release_Date and "".



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

As smoupre said, you cannot sombine a text value ("Date NA") and a date type value in a single result. But you could replace "NA" with Blank() if the corresponding version has no release date.

 

MyDate measure =
VAR VersionNum =
    CALCULATE (
        LASTNONBLANK ( Query1[Version], 1 ),
        Query1[cummulative_version_adoption] >= 0.5
    )
VAR VersionDate =
    CALCULATE ( MIN ( [Version_Release_Date] ), Query1[Version] = VersionNum )
RETURN
    IF ( ISBLANK ( VersionDate ), BLANK (), VersionDate )

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

As smoupre said, you cannot sombine a text value ("Date NA") and a date type value in a single result. But you could replace "NA" with Blank() if the corresponding version has no release date.

 

MyDate measure =
VAR VersionNum =
    CALCULATE (
        LASTNONBLANK ( Query1[Version], 1 ),
        Query1[cummulative_version_adoption] >= 0.5
    )
VAR VersionDate =
    CALCULATE ( MIN ( [Version_Release_Date] ), Query1[Version] = VersionNum )
RETURN
    IF ( ISBLANK ( VersionDate ), BLANK (), VersionDate )

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank You, Yuliana. The solution is working perfectly fine

Greg_Deckler
Community Champion
Community Champion

Perhaps something along these lines:

 

MyDate = VAR VersionNum = CALCULATE(LASTNONBLANK(Query1[Version],1),Query1[cummulative_version_adoption]>=0.5)

VAR VersionDate = CALCULATE(MIN([Version_Release_Date]),Query1[Version] = VersionNum)

RETURN

IF(ISBLANK(VersionDate),"Date NA",VersionNum)

This assumes that Version_Release_Date is text, if it is an actual DATE value you will probably have to convert it to the text representation of the date. You can do that with a CONCATENATE of the Version_Release_Date and "".



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thank You, smoupre. The solution is working.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors