Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi, I'm trying to create a column/measure in direct query mode but it doesn't work. (it works in imported mode).
The error:
A single value for column 'NGAY_HL' in table 'BI_XE_HOP_DONG' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
My dax:
DELTA_NGAY = if(DATEDIFF('BI_XE_HOP_DONG'[NGAY_HL], TODAY(), DAY) > 0, IF(DATEDIFF('BI_XE_HOP_DONG'[NGAY_HL], TODAY(), DAY)>'BI_XE_HOP_DONG'[PERIOD], 'BI_XE_HOP_DONG'[PERIOD],DATEDIFF('BI_XE_HOP_DONG'[NGAY_HL], TODAY(), DAY)) ,0)
I want to create a column/measure check if NGAY_HL < TODAY and datediff of NGAY_HL and today > period then the result is period; Else, The result is DATEDIFF('BI_XE_HOP_DONG'[NGAY_HL], TODAY())
Thank you!
Solved! Go to Solution.
@qlnv , This should work as a column , In case of measure you need to use aggregation on column or use them inside x functions
DELTA_NGAY = sumx('BI_XE_HOP_DONG', if(DATEDIFF('BI_XE_HOP_DONG'[NGAY_HL], TODAY(), DAY) > 0, IF(DATEDIFF('BI_XE_HOP_DONG'[NGAY_HL], TODAY(), DAY)>'BI_XE_HOP_DONG'[PERIOD], 'BI_XE_HOP_DONG'[PERIOD],DATEDIFF('BI_XE_HOP_DONG'[NGAY_HL], TODAY(), DAY)) ,0))
@qlnv , This should work as a column , In case of measure you need to use aggregation on column or use them inside x functions
DELTA_NGAY = sumx('BI_XE_HOP_DONG', if(DATEDIFF('BI_XE_HOP_DONG'[NGAY_HL], TODAY(), DAY) > 0, IF(DATEDIFF('BI_XE_HOP_DONG'[NGAY_HL], TODAY(), DAY)>'BI_XE_HOP_DONG'[PERIOD], 'BI_XE_HOP_DONG'[PERIOD],DATEDIFF('BI_XE_HOP_DONG'[NGAY_HL], TODAY(), DAY)) ,0))
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
7 | |
7 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |