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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

SQL to DAX Conversion

Hi everyone,

 

I have a working SQL query that I would like to put into PowerBI.  I'm not sure exaclty how to convert SQL to DAX so any help would greatly be appreciated thanks!

 

SELECT Left(AcademicSemester,3),
AcademicWeek, SUM(Swipe)/COUNT(Distinct AcademicSemester)
as AverageSwipe
FROM
Table
Where AcademicWeek is not NULL
Group BY AcademicWeek, Left(AcademicSemester,3)

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous ,

 

You need have a new colum
AcademicSemester new= Left(Table[AcademicSemester],3)

Then put these two on visual AcademicSemester new , Table[AcademicWeek ] as unsummarize
and use this mesure
measure = divide(SUM(Table[Swipe]),Distinctcount(Table[AcademicSemester]))

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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous ,

 

You need have a new colum
AcademicSemester new= Left(Table[AcademicSemester],3)

Then put these two on visual AcademicSemester new , Table[AcademicWeek ] as unsummarize
and use this mesure
measure = divide(SUM(Table[Swipe]),Distinctcount(Table[AcademicSemester]))

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
Anonymous
Not applicable

@amitchandak 

Worked perfectly.  Thank you!

Pragati11
Super User
Super User

Hi @Anonymous ,

 

Please provide some sample data that you are uisng.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

@Pragati11 

Here is sample data

AcademicSemesterAcademicWeekAverageSwipe
Spr310,250.5
Fal1025,508.6
Sum48,765.8

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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