Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi All,
i have table dataset in the below format,
| ID | Date | App name | Duration |
| 100 | 01-12-2022 | METER | 10 |
| 100 | 01-12-2022 | 20 | |
| 101 | 01-12-2022 | FB | 20 |
| 102 | 01-12-2022 | METER | 10 |
| 100 | 02-12-2022 | METER | 10 |
| 101 | 02-12-2022 | 30 | |
| 102 | 02-12-2022 | METER | 10 |
| 100 | 03-12-2022 | 30 | |
| 101 | 03-12-2022 | METER | 10 |
| 101 | 03-12-2022 | 20 | |
| 102 | 04-12-2022 | METER | 10 |
First part was to calculate ATS = duration/distinctcount(ID) for each day excluding "METER" app. I used below DAX for the calculation
Solved! Go to Solution.
HI @Anonymous,
You can use the following measure formula to check current id related records within current date ranges and return flag:
flag =
VAR currDate =
MAX ( 'Table'[Date] )
VAR appList =
CALCULATETABLE (
VALUES ( 'Table'[App name] ),
FILTER (
ALLSELECTED ( 'Table' ),
YEAR ( 'Table'[Date] ) = YEAR ( currDate )
&& MONTH ( 'Table'[Date] ) = MONTH ( currDate )
),
VALUES ( 'Table'[ID] )
)
RETURN
IF ( "METER" IN appList && COUNTROWS ( appList ) = 1, "Y", "N" )
Regards,
Xiaoxin Sheng
Was able to solve above prob in SQL for one day taken at a time:
SELECT ID
FROM tabel
WHERE Date='2022-12-01'
GROUP BY ID
HAVING MIN(app name)=MAX(app name)
AND MIN(app name) in ('METER')
Can somebody help the above same in DAX method ?
HI @Anonymous,
You can use the following measure formula to check current id related records within current date ranges and return flag:
flag =
VAR currDate =
MAX ( 'Table'[Date] )
VAR appList =
CALCULATETABLE (
VALUES ( 'Table'[App name] ),
FILTER (
ALLSELECTED ( 'Table' ),
YEAR ( 'Table'[Date] ) = YEAR ( currDate )
&& MONTH ( 'Table'[Date] ) = MONTH ( currDate )
),
VALUES ( 'Table'[ID] )
)
RETURN
IF ( "METER" IN appList && COUNTROWS ( appList ) = 1, "Y", "N" )
Regards,
Xiaoxin Sheng
Thank you so much for the response. So i was applying the same measure that you have given but my actual dataset is huge so keeping ID, app name and date is not loading the measure. (data that i pasted in question was just a sample).
Is it possible to show the flag against each ID in visual avoiding the app and date from the visual ?
Hi @Anonymous,
In fact, this expression will check at the year month level based on current ID group.
If you only use ID as category without other fields, the formula will get wrong results because the aggregate row contexts have matched with multiple type of flags.
Regards,
Xiaoxin Sheng
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 31 | |
| 31 | |
| 20 | |
| 12 | |
| 12 |