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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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