Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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
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.
User | Count |
---|---|
14 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
21 | |
11 | |
10 | |
10 | |
8 |