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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
AsNa_92
Resolver II
Resolver II

Add Row if data missing from dataset

Hi Guys,

 

How Can I add row (data) if the data from source is missing?

 

For Instance, I have category with value (Red=50, Green=20, Black=5) in 2024/09/01

But in 2024/09/02 the data is (Red=30, Black=80)

How can I add data for Green with 0 if there is no data for it? Condition which is static for all days in future.

1 ACCEPTED SOLUTION

Hello @AsNa_92 
As per your requirement you need to create a calculated table cause here you're trying to add a row with the alternative result for category date wise.
So Try the below DAX to create a calculated table;

RESULT_TABLE =
ADDCOLUMNS(
    CROSSJOIN(
        DISTINCT('TABLE1'[Date]),
        DISTINCT('TABLE1'[Category])
    ),
    "Value",
    COALESCE(
        LOOKUPVALUE('TABLE1'[Value], 'TABLE1'[Date], [Date], 'TABLE1'[Category], [Category]),
        0
    )
)
TASK2.png
 
OR
There's another way to get your desired result using M-Queries on transfer data but for that also you need to add another table .
OR
You can modify your used database Query.
 
Thanks & Regards...

View solution in original post

5 REPLIES 5
Joe_Barry
Super User
Super User

Hi @AsNa_92 

 

There are various ways of doing it depending on your source, but in Power Query, I would create a new table that has the same columns as the existing one or at least the columns that you need. You can do this by using the Enter Data function in the Ribbon. Make sure that the column names match that of the other table, watch out for lower & upper case. Fill in the row with Green 0 and what ever the other columns you have.

 

When you are finished go to the original table and choose Append table and choose the table you just created. It will now be part of that table.

 

Regarding that it's static for all days in the future, this depends on the columns you have in the original table.

In DAX you could create a running total measure that will populate a visual or a table based on the date range you have chosen.

 

Running Total = 
VAR _MaxDate = MAX('Calendar'[Date])
RETURN
CALCULATE(
    SUM('Table'[Amount]), ///Is your table showing a culmative value? Then use MAX instead of SUM
    FILTER( ALL('Calendar'),
   'Calendar'[Date] <= _MaxDate
    )

 


Add this measure to a visual along with the columns from your calendar table that you want to use for showing the date and the colour column from your table and you will egt the result you want

Joe_Barry_0-1727159475830.png

Hope this helps

Joe




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

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn


Let's connect on LinkedIn


Hi @Joe_Barry 

thanks for replying .. but is there a way of adding a column or measure in the same table table instead of doing all that? 

I'm using oracle database table and it gets refreshed monthly.

BIswajit_Das
Super User
Super User

Hello @AsNa_92 
It would be better if you share some demo data in order to check the formats and to understand your requirement better.
And as per the mentioned above example;

1 - If you are loading the data using database queries then you can modify the column in the query and load the desired data.

or
2 - You can also create a calculated column with some conditions to get your required result column.

Thanks & Regards...

Hi @BIswajit_Das 

Thanks for your reply, if I want to add column with condition how can i apply that?

Since I'm using oracle database table which refresh monthly.

 

Sample Data:

DateCategoryValue
2024/09/01Red50
2024/09/01Yellow40
2024/09/01Black5
2024/10/01Red90
2024/10/01Black30

 

Output:

DateCategoryValue
2024/09/01Red50
2024/09/01Yellow40
2024/09/01Black5
2024/10/01Red90
2024/10/01Black30
2024/10/01Yellow0

Hello @AsNa_92 
As per your requirement you need to create a calculated table cause here you're trying to add a row with the alternative result for category date wise.
So Try the below DAX to create a calculated table;

RESULT_TABLE =
ADDCOLUMNS(
    CROSSJOIN(
        DISTINCT('TABLE1'[Date]),
        DISTINCT('TABLE1'[Category])
    ),
    "Value",
    COALESCE(
        LOOKUPVALUE('TABLE1'[Value], 'TABLE1'[Date], [Date], 'TABLE1'[Category], [Category]),
        0
    )
)
TASK2.png
 
OR
There's another way to get your desired result using M-Queries on transfer data but for that also you need to add another table .
OR
You can modify your used database Query.
 
Thanks & Regards...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Solution Authors