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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Jensej
Helper V
Helper V

SQL into Dax

Hello!

 

I have a table in Power Bi with a Month Column Jan-Dec for year 2020. Now i want to a second column that shows the people who resigned in that month. 

In sql i would solve it like this but i don't know if it would work if just create a measure and i don't know the dax code for it. 

 

Can someone help with the dax code for this select?

 

SELECT Name + CAST(day(Resign_Date) as varchar) as Name FROM BI_Adr
WHERE Entry_Date <= GETDATE() and Resign_Date > GETDATE()

 

7 REPLIES 7
amitchandak
Super User
Super User

@Jensej , In a table visual take name, Resign_Date and this measure

 

measure  =calculate(countrows(Table), filter(Table, Table[Entry_Date] <=Today() && Table[Resign_Date] >=Today()))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

HI @amitchandak  

 

Thanks for your reply, if i do this i get this error message in the table visual. "A table of multiple values was supplied where a single value was expected"

@Jensej , Can you share your measure

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

 

 

Measure 2 = 
VAR first= min(JF_BI_Datum[Datum])
VAR last= max(JF_BI_Datum[Datum])

RETURN
calculate(countrows(JF_BI_Adr), filter(JF_BI_Adr,DATESBETWEEN(JF_BI_Adr[Resign_Date],first,last)))

 

 

@Jensej , Try like

 

Measure 2 =
VAR first= minX(allselected(JF_BI_Datum), JF_BI_Datum[Datum])
VAR last= maxX(allselected(JF_BI_Datum),JF_BI_Datum[Datum])

RETURN
calculate(countrows(JF_BI_Adr), filter(JF_BI_Adr,DATESBETWEEN(JF_BI_Adr[Resign_Date],first,last)))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

HI @amitchandak 

 

I almost solved the problem with this Measure. It shows me the day and name of the person that left that month. It works perfect as long as only one person left that month but if it's more it only shows 1 person. Is there some way to do some kind of loop and see if there is more persons and then add like a  comma and that person on the same row? 

Resigns = 
CALCULATE (
DAY(min(JF_BI_Adr[Resign_Date])) & " " & min(JF_BI_Adr[Full Name]), USERELATIONSHIP (JF_BI_Adr[Resign_Date], JF_BI_Datum[Datum] ))

 

Sadly still the same error 😞 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.