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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
sharong
Helper I
Helper I

Help me in converting this snowflake query into Power BI

Hi folks,

 

I have a query which needs to be implemented in Power BI. 

I have two tables. MARTSITEMS and DIM_Date

I want to inner join both the tables and get a aggregated table for Monthly. After getting this aggreagted table, I also want to use slicers from MARTITEMS so that slice and dice will also happen on aggreagted table. I dont know whether to use M code or DAX to perform this query. Please help.

 

Below is the query:
select dt.date, count(distinct kunnr), sum(dmbtr) as total_receivables,
sum(case when dt.date > di.duedate then di.dmbtr else 0 end) as Total_overdue,
Total_overdue/total_receivables as overdue_percent,
1-overdue_percent as not_due_percent,
from DEV_MARTSITEMS di
inner join (select last_day_month as date from DEV_DIM_DATE
group by last_day_month) dt
on (dt.date between di.budat and di.augdt ) or (di.augdt is null and dt.date >= di.budat)
where dt.date >= add_months(current_date(), -14) and dt.date <= current_date()
group by dt.date
order by dt.date asc;

 

Expected output; This table visualization should also slice and dice according to filters applied by user 

 

sharong_0-1697092843258.png

 

@NikhilChenna @SiemdeKort 

 

1 REPLY 1
lbendlin
Super User
Super User

No need for either M or DAX. Let the data model do the work for you.  Something akin to an inner join is achieved by filtering out blanks from both tables.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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