March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have a raw table name as Query1 which contains logs of call status for multiple students. It has 4 columns student_id, enquire_date, call_status, date_added. One student_id has only 1 enquire_date but it may have many different date_added and call_status.
i have to create a visual where 2 slicer options needs to be given one for enquire_date one for disposition_date. Dispostion date is basically the date for which we need to check the latest availaible call_status of student_id.
for eg if i select enquire_date as 1 Oct 2024 then and dispostion_date as 3 Oct 2024, the table should show the latest availaible call status for 1 Oct 2024 enquired students whose latest date_added can be 3 Oct 2024 or before.
Data Tables:
CalenderTable is a calculated table which i have created which just has calender dates and it is not in relationship with Query1. Date from Calender Table I will be using as Disposition Date.
Call Status for Latest Date and Latest Availaible Date Added are the two dynamic measures which I have created which are using 2 slicers as input.
Measure 2 Calculation:
This is the output and table is showing correct data:
I have to export this table as excel and then apply a pivot to check the call status and unique student count aggregated.
I need a way to create same visual in power BI without exporting it in excel but unable to do it as I cannot use measures as a row.
Solved! Go to Solution.
These are the measures I've come up with
Latest Date =
VAR DispositionDate =
MAX ( CalendarTable[Date] )
RETURN
CALCULATE (
MAX ( Query1[date_added] ),
ALLEXCEPT ( Query1, Query1[student_id] ),
KEEPFILTERS ( INT ( Query1[date_added] ) <= DispositionDate )
)
Count by Status =
VAR _latestdate = [Latest Date]
RETURN
COUNTROWS (
FILTER (
ADDCOLUMNS (
SUMMARIZE (
Query1,
Query1[student_id],
Query1[call_status],
Query1[date_added]
),
"@latest date", [Latest Date]
),
[@latest date] = [date_added]
)
)
Please note that i wrapped date_added with INT as it is a date_time and you're comparing it against a date so essentially, with your current logic, <= will exclude anything beyond 12:00 AM
How do you handle these duplicate records?
Count by status measure counts onlyn once.
Proud to be a Super User!
Can you please post a workable sample data (not an image) and your expected result from that.
Proud to be a Super User!
https://docs.google.com/spreadsheets/d/12tMw23sjm7JGqthQs1OzkGvBOP3aW50m/edit?usp=sharing&ouid=11639...
Please find the raw data here.
These are the measures I've come up with
Latest Date =
VAR DispositionDate =
MAX ( CalendarTable[Date] )
RETURN
CALCULATE (
MAX ( Query1[date_added] ),
ALLEXCEPT ( Query1, Query1[student_id] ),
KEEPFILTERS ( INT ( Query1[date_added] ) <= DispositionDate )
)
Count by Status =
VAR _latestdate = [Latest Date]
RETURN
COUNTROWS (
FILTER (
ADDCOLUMNS (
SUMMARIZE (
Query1,
Query1[student_id],
Query1[call_status],
Query1[date_added]
),
"@latest date", [Latest Date]
),
[@latest date] = [date_added]
)
)
Please note that i wrapped date_added with INT as it is a date_time and you're comparing it against a date so essentially, with your current logic, <= will exclude anything beyond 12:00 AM
How do you handle these duplicate records?
Count by status measure counts onlyn once.
Proud to be a Super User!
Thanks a lot man @danextian. This worked perfectly fine. I removed the duplicate rows and null call status values from source itself.
and for a unique date added i considered only one latest row as per time for that day.
Able to get the desired output in same view as expected. Thanks a lot. Was not able to solve this problem since months even after using Chat GPT.
You are genius!!
Can you suggest any way please?
@Jai-Rathinavel @danextian @Bibiano_Geraldo @rajendraongole1
Hi @Yaseen_Nadaf ,
Can you please share a sample pbi file with no sensitive data? please.
https://drive.google.com/file/d/1qG6UW74cCXgoiETFAsBwWVUsvffHN5yI/view?usp=drive_link
Please find the pbi file here:
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
167 | |
117 | |
63 | |
57 | |
50 |