cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper V
Helper V

Different periods for different measures

Hello everyone!

I have this PBI file File

I need to be able to present the selected year in the visualization with respect to the previous year to show the values of the measures. How can I do this?

Img1.JPG
Thank you very much.

1 ACCEPTED SOLUTION

This is my solution:

Mesures:

T.Facturas = ABS(CALCULATE(SUM(Contabilidad[Amount]),Contabilidad[Document Type]=1))
 
TotalFacturas =
         Var ActualYear = MAX(Calendario[Año])
         Return IF(MAX(Periodos[Año])=ActualYear, [T.Facturas], IF(MIN(Periodos[Año])=ActualYear-1,CALCULATE([T.Facturas], DATEADD(Calendario[Fecha], -1,YEAR)), [T.Facturas]))
 
 

View solution in original post

5 REPLIES 5
Resolver II
Resolver II

There is no need for a 2nd date table, this can easily be done using only 1 with the right measures:

MaxYearValue = 
VAR vMaxYear = 
    MAX ( DateTable[Year] )
RETURN
    CALCULATE ( 
        SUM ( Data[Value] ),
        DateTable[Year] = vMaxYear
    )
PreviousYearValue = 
VAR vMaxYear = 
    MAX ( DateTable[Year] )
RETURN
    CALCULATE ( 
        SUM ( Data[Value] ),
        DateTable[Year] = vMaxYear - 1
    )

image.png

Thanks @Arklur and @amitchandak  you for your help. It's not exactly what I needed but it's given me a couple of ideas.

Hi , @Raul 

Can you explain bit more?

For now, there is no other content of description in the thread. If you still need help, please share more details to us.

 

Best Regards,
Community Support Team _ Eason

This is my solution:

Mesures:

T.Facturas = ABS(CALCULATE(SUM(Contabilidad[Amount]),Contabilidad[Document Type]=1))
 
TotalFacturas =
         Var ActualYear = MAX(Calendario[Año])
         Return IF(MAX(Periodos[Año])=ActualYear, [T.Facturas], IF(MIN(Periodos[Año])=ActualYear-1,CALCULATE([T.Facturas], DATEADD(Calendario[Fecha], -1,YEAR)), [T.Facturas]))
 
 

View solution in original post

Super User IV
Super User IV

@Raul ,refer if this can help

 

https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

 

You need two date table in such case



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Microsoft Ignite

Microsoft Ignite with Arun Ulag

Featured Session: Drive Data Culture with Power BI- Vision, Strategy & Roadmap. Register here https://myignite.microsoft.com #MSIgnite #PowerPlatform #Power BI ​

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors