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
huynq
Frequent Visitor

I need to create new table with total values of each category and continues date.

Hi guys

 

I'm sorry if my bad English confuse you. Thank you for comming.

I need a solution or any advices on this dataset

My Input:

Date                Name                Value

10/29/2020     A                       1

11/02/2020     A                       1

11/01/2020     B                       2

11/02/2020     C                       1
10/29/2020     A                       3


My expected:

 

Date                Name                Value

10/29/2020     A                       4

10/30/2020     A                       0

11/01/2020     A                       0

11/02/2020     A                       1

10/29/2020     B                       0

10/30/2020     B                       0

11/01/2020     B                       1

11/02/2020     B                       0

10/29/2020     C                       0

10/30/2020     C                       0

11/01/2020     C                       0

11/02/2020     C                       1

 

Thanks in advance

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@huynq,

 

Try this calculated table. You need a Date table in your data model.

 

DailyValue = 
VAR vNames =
    DISTINCT ( Table4[Name] )
VAR vStartDate =
    MIN ( Table4[Date] )
VAR vEndDate =
    MAX ( Table4[Date] )
VAR vDates =
    CALCULATETABLE (
        DISTINCT ( Dates[Date] ),
        Dates[Date] >= vStartDate
            && Dates[Date] <= vEndDate
    )
VAR vResult =
    GENERATEALL (
        vNames,
        ADDCOLUMNS (
            vDates,
            "Value",
                IF (
                    ISBLANK ( CALCULATE ( SUM ( Table4[Value] ) ) ),
                    0,
                    CALCULATE ( SUM ( Table4[Value] ) )
                )
        )
    )
RETURN
    vResult

 

DataInsights_0-1604695480992.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
huynq
Frequent Visitor

Many thanks to you @DataInsights . It works like a charm. 

DataInsights
Super User
Super User

@huynq,

 

Try this calculated table. You need a Date table in your data model.

 

DailyValue = 
VAR vNames =
    DISTINCT ( Table4[Name] )
VAR vStartDate =
    MIN ( Table4[Date] )
VAR vEndDate =
    MAX ( Table4[Date] )
VAR vDates =
    CALCULATETABLE (
        DISTINCT ( Dates[Date] ),
        Dates[Date] >= vStartDate
            && Dates[Date] <= vEndDate
    )
VAR vResult =
    GENERATEALL (
        vNames,
        ADDCOLUMNS (
            vDates,
            "Value",
                IF (
                    ISBLANK ( CALCULATE ( SUM ( Table4[Value] ) ) ),
                    0,
                    CALCULATE ( SUM ( Table4[Value] ) )
                )
        )
    )
RETURN
    vResult

 

DataInsights_0-1604695480992.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.