Forum Discussion
Dates compare - issue
Hi all,
I have a problem when I try to compare date from a table (SCHEDE[DataRiferimento]) and a date calculate with a measure [Data_AnnoCorrente]:
Importo_Assegnato =
CALCULATE(
SUM('SCHEDE'[Somma di Amount]),
FILTER(SCHEDE, SCHEDE[TipoSpesa] = "Assegnato" && SCHEDE[DataRiferimento] = [Data_AnnoCorrente])
)
Filter doesn't work.
I try to do anything: change date type, cast both date to text using FORMAT("YYYY-MM-DD"), cast both to DATE:
Importo_Assegnato =
CALCULATE(
SUM('SCHEDE'[Somma di Amount]),
FILTER(SCHEDE, SCHEDE[TipoSpesa] = "Assegnato" && DATE(YEAR(SCHEDE[DataRiferimento]),MONTH(SCHEDE[DataRiferimento]),day(SCHEDE[DataRiferimento])) = Date(YEAR([Data_AnnoCorrente]),MONTH([Data_AnnoCorrente]),DAY([Data_AnnoCorrente])
)))
The only way filter works it's create Date and insert data hardcode:
Importo_Assegnato =
CALCULATE(
SUM('SCHEDE'[Somma di Amount]),
FILTER(SCHEDE, SCHEDE[TipoSpesa] = "Assegnato" && SCHEDE[DataRiferimento] = Date(2023,04,14)))
Please help me,
M
1 Reply
- lbendlinSuper User
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523