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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Diego_Vialle
Helper II
Helper II

DAX - How to introduce dcalendar on the x axis of a measure chart?

I have two measures for the sum of customers who NEVER PURCHASED, BUT PURCHASED in the last three months. How do I insert the dcalendar table on the "x" axis to have the period shown in the chart?

 

When entering the dcalendar, the values are different from those calculated by the measurements. Follow the measures below:

 

Diego_Vialle_0-1653057247897.png

Measure for current customers:

 

Novos Clientes Trimestrais =
VAR AllOldCustomers =
CALCULATETABLE (VALUES ( SBOPRODMS[Nome do PN] ),
SBOPRODMS,
SBOPRODMS[Data NF] < TODAY () - 90,
SBOPRODMS[Documento] = "Nota fiscal de saída"
)
VAR AllNewCustomers =
CALCULATETABLE (VALUES ( SBOPRODMS[Nome do PN] ),
SBOPRODMS[Data NF] < TODAY () ,
SBOPRODMS[Documento] = "Nota fiscal de saída"
)
RETURN
IF(ISBLANK((COUNTROWS ( EXCEPT (AllNewCustomers, AllOldCustomers )))),0,COUNTROWS ( EXCEPT (AllNewCustomers, AllOldCustomers )))
 
Measure for customers from the previous period:

 

Novos Clientes Trimestrais PY =
     VAR PreviousYearDate = DATE ( YEAR ( TODAY () ) - 1, MONTH ( TODAY () ), DAY ( TODAY () ) )
        VAR AllOldCustomers = CALCULATETABLE ( VALUES ( SBOPRODMS[Nome do PN] ),
        SBOPRODMS, SBOPRODMS[Data NF] < PreviousYearDate - 90,
        SBOPRODMS[Documento] = "Nota fiscal de saída" )
        
        VAR AllNewCustomers = CALCULATETABLE ( VALUES ( SBOPRODMS[Nome do PN] ),
        SBOPRODMS[Data NF] < PreviousYearDate,
        SBOPRODMS[Documento] = "Nota fiscal de saída" )
        
RETURN IF ( ISBLANK ( ( COUNTROWS ( EXCEPT ( AllNewCustomers, AllOldCustomers ) ) ) ), 0, COUNTROWS ( EXCEPT ( AllNewCustomers, AllOldCustomers ) ) )
3 REPLIES 3
tamerj1
Super User
Super User

Hi @Diego_Vialle 

have you tried with SBOPRODMS[Data NF] column? I guess further running total technique should be applied. 

Hi @tamerj1 

 

Do you have any idea how I can solve this and use dCalendar?

Yes, but using it is changing the value of measurements.

 

Diego_Vialle_0-1653060850814.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.