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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Time Intelligence: "Nested DAX" gives me strange result (vs Two measures)

Hello everybody,

 

I have this doubt. I am using time intelligence and I did a task of getting the porcentual increase comparing the same period of the last year in two ways:

1. I create a new measure called "Utilidad" año Anterior: 

     Utilidad Año Anterior = CALCULATE(sum(Ventas[Utilidad]),SAMEPERIODLASTYEAR('DAX Calendario 3'[Fecha]))
    Then, I create the division to get the porcentual difference:  
     Crecimiento Utilidad = DIVIDE(SUM(Ventas[Utilidad]),[Utilidad Año Anterior])-1
2. I made a "nested" function with VAR:
    Crecimiento Utilidad Periodo Anterior =
      VAR Utilidad = SUM(Ventas[Utilidad])
      VAR UtilidadPeriodoAnterior = CALCULATE(Utilidad, SAMEPERIODLASTYEAR('DAX Calendario 3'[Fecha]))
      RETURN DIVIDE(Utilidad,UtilidadPeriodoAnterior,"N.A.")-1
 
But I got two differents results:
ARamos_77_0-1635859665835.png

 

 I'd really appreciate if anyone can give an explanation why the second DAX didn't work
 
Thanks in advance!
 
ps: Finally, is there a way to avoid -100% in the first formula?
1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, your error is because the <alternateresult> in the DIVIDE function should be a number but not text. Heres my solution.

vkalyjmsft_0-1636092175397.png

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, your error is because the <alternateresult> in the DIVIDE function should be a number but not text. Heres my solution.

vkalyjmsft_0-1636092175397.png

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , POwer bi return blank when there is not data, but blank -1 = -1 , it not like null  in database

 

In the second one try like

RETURN DIVIDE(Utilidad,UtilidadPeriodoAnterior,0)-1

 

I doubt the text creating a problem

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.