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
Anonymous
Not applicable

Line Graphs Accumulated and empty when date < today

Hi guys, I made a line graph with 3 mesures: Planned Date, Projected Date and Real date. Both the mesures has the same dax code, just switching the date fields.

The code I used below is to accumulated the count from a previews date with the formula MAX: 

Teste Acumulado Real = CALCULATE([Contagem Tarefas Real];FILTER(ALLSELECTED(dCalendario);dCalendario[Datas]<=MAX(dCalendario[Datas]))

What I need is when the date is < today show an empty result for that month (year and so on..)

 

That's the graph I m building: https://imge.to/i/g97Ur

In short I want only the red line to stop in june because that's today's date.

 

Thank you.

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

Try to change your measure to the following:

Teste Acumulado Real =
IF (
    MAX ( dCalendario[Datas] ) >= TODAY ();
    BLANK ();
    CALCULATE (
        [Contagem Tarefas Real];
        FILTER (
            ALLSELECTED ( dCalendario );
            dCalendario[Datas] <= MAX ( dCalendario[Datas] )
        )
    )
)

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

Teste Acumulado Real=IF(MAX(dCalendario[Datas])>=TODAY ();BLANK ();CALCULATE([Contagem Tarefas Real];DATESBETWEEN(dCalendario[Datas];MINX(ALL(dCalendario),dCalendario[Datas]);MAX( dCalendario[Datas]))))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
MFelix
Super User
Super User

Hi @Anonymous ,

 

Try to change your measure to the following:

Teste Acumulado Real =
IF (
    MAX ( dCalendario[Datas] ) >= TODAY ();
    BLANK ();
    CALCULATE (
        [Contagem Tarefas Real];
        FILTER (
            ALLSELECTED ( dCalendario );
            dCalendario[Datas] <= MAX ( dCalendario[Datas] )
        )
    )
)

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Thank you, I tried to do the if statment inside the filter code but it didn't work.

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.