Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
_Kevin_
Helper I
Helper I

Utilice un resultado de medida como fecha

Hola

Tengo 2 medidas como sigue:

a) CurrentMonth - MAX((Info[Reporting Month])) - Representa "2020/04/30" y
b) HCCurrentMonth - CALCULATE(SUM(HC_ACT[Headcount]),HC_ACT[TIME] - DATE(2020,04,30))
Me gustaría utilizar la primera medida para reemplazar la fecha en la segunda medida, pero esto no funciona, y da el error "Una función 'CALCULATE' se ha utilizado en una expresión True/False que se utiliza como una expresión de filtro de tabla."
¿Cómo puedo lograr el resultado previsto?
Gracias
Kevin
1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hola @_Kevin_

Tratar

HCCurrentMonth = 
var _CurrentMonth = MAX((Info[Reporting Month]))
RETURN

CALCULATE(SUM(HC_ACT[Headcount]),HC_ACT[TIME] = _CurrentMonth )

O

HCCurrentMonth = CALCULATE(SUM(HC_ACT[Headcount]),FILTER(HC_ACT, HC_ACT[TIME] = SELECTEDVALUE([CurrentMonth]) ))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

5 REPLIES 5
Tahreem24
Super User
Super User

Hola Kevin,

HCCurrentMonth á CALCULATE(SUM(HC_ACT[Headcount]), FILTER(HC_ACT,HC_ACT[TIME] á MAX(HC_ACT[TIME])))

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
az38
Community Champion
Community Champion

Hola @_Kevin_

Tratar

HCCurrentMonth = 
var _CurrentMonth = MAX((Info[Reporting Month]))
RETURN

CALCULATE(SUM(HC_ACT[Headcount]),HC_ACT[TIME] = _CurrentMonth )

O

HCCurrentMonth = CALCULATE(SUM(HC_ACT[Headcount]),FILTER(HC_ACT, HC_ACT[TIME] = SELECTEDVALUE([CurrentMonth]) ))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hola @az38

Gracias, la primera opción funciona muy bien.

Hubiera preferido usar la segunda opción, pero no puedo usar una medida en SELECTEDVALUE y obtener "Parámetro no es el tipo correcto"

saludos

Kevin

az38
Community Champion
Community Champion

@_Kevin_

probar MAX() en lugar de SELECTEDVALUE() como @Tahreem24 mencionado


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hola @az38

No necesito tampoco, ahora he puesto la medida justo después de "" y funciona también.

saludos

Kevin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.