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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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