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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
MauroBote
Helper I
Helper I

Generar registro de fecha con valor 0 en caso de no existir fecha

Hola.
Tengo una tabla con las columnas tipo de producto, monto de la venta y fecha de la venta, la cual debo graficarla como una linea con los montos acumulados por fecha. Este grafico debe poder filtrarse por tipo de producto y rango de fechas calendario, para lo cual genere un tabla de calendario.

Mi problema se presenta en que si uno en el rango de fecha selecciona una fecha inicial y una fecha final, si la fecha inicial no existe en la tabla debe graficarla en el grafico como 0 y mantenerlo hasta llegar al punto del monto de la primera fecha de venta incluida en el rango seleccionado. Por otro lado la fecha final, en caso de no existir, debe graficarse tambien manteniendo el monto acumulado de la ultima venta registrada en el rango de fechas seleccionado.

¿Como puedo hacer para generar este grafico correctamente con los valores 0 cuando no existe venta?

4 REPLIES 4
Anonymous
Not applicable

Hi @MauroBote ,

 

Based on my test, the best way I can think of at the moment is "+0".

You can add "+0" in your measure. For example,

Measure = SUM('Table'[sale amount])+0

vstephenmsft_0-1652166459495.png

Neither April 17 nor May 31 are listed in the Sales Date column of the main table. The disadvantage is that other dates that are not in the sales date column are all 0.

 

 

 

Best Regards,

Stephen Tao

 

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

 

Thanks Stephen Tao!
It doesn't work for me because when I add the 0, the graphic show al dates (as amount 0) and not only the selected dates on slicer.
The problem of the 0 between the selected dates on slicer no matter because I'm doing a running total formula for the amounts.
If there is a way to restringe the grapich just for selected dates on slicer, it would be a perfect solution.

MauroBote
Helper I
Helper I

Thanks, but it doesn´t work. Actually I have already this formula and doesn't show the initial date on the graphic:

 

CALCULATE(
    SUM(HITOS[MONTO]),
    USERELATIONSHIP(CALENDARIO[Date],HITOS[FECHA]),FILTER(
        ALLSELECTED(CALENDARIO[Date]),
        MAX(CALENDARIO[Date])<=(HITOS[FECHA])&&ISONORAFTER(CALENDARIO[Date], MAX(CALENDARIO[Date]), DESC)
    )

Any other idea?
amitchandak
Super User
Super User

@MauroBote , Check if a measure like this can help

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[Date])))

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.