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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Keeping null values in aggregation table

I"m working on a report to identify if resources have been committed correctly to various projects. The demand hours, commit hours, and constrained hours (gap hours) are on three different rows in the data set and I'm trying to consolidation all of them to 1 row. I created a Y\N flag to identify if the value in the committed column is either 0 or null. the data set looks like this:

 

WorkCategoryValueProject NameIDResourceRoleValueResourceNameIdTaskDetailTier34OrgIdMonthCatHoursDateDemand HrsCommit HrsBlankCommitFlag
Project35Electrical Engineer 2 TTS Analyst11AugGap488/1/202000N
Project35Electrical Engineer 2 TTS Analyst11Aug 488/1/2020480N
Project35Electrical Engineer 2 TTS Analyst11AugCommit 8/1/20200 Y

 

 

           

 

I aggregated the data set, but I'm generating two rows where there should be only one, it appears as follows:

WorkCategoryValueProjectNameIdResourceRoleValueResourceNameIdTaskDetailDateBlankCommitFlagDemand HrsCommit Hrs
Project35Electrical Engineer 2 TTS Analyst8/1/2020N480
Project35Electrical Engineer 2 TTS Analyst8/1/2020Y0 

 

I'm trying to find a way to replace the 0 values with null so I can consolidate the aggregated table into 1 row. I'm not sure how to do this and could use some help, 

 

ixdutt

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

I build the same table as yours to have a test.

1.png

Just like mwegener replied before you when you summarize ,you dont need to add the BlankCommitFlag.

I build Measure to achieve your goal.

'AGG_REsource Request =

VAR _MAXDH =

    MAXX (

        FILTER (

            ALL ( 'Table' ),

            'Table'[Project NameID] = MAX ( 'Table'[Project NameID] )

        ),

        'Table'[Demand Hrs]

    )

VAR _MAXGH =

    MAXX (

        FILTER (

            ALL ( 'Table' ),

            'Table'[Project NameID] = MAX ( 'Table'[Project NameID] )

        ),

        'Table'[Gap Hours]

    )

VAR _MAXCS =

    MAXX (

        FILTER (

            ALL ( 'Table' ),

            'Table'[Project NameID] = MAX ( 'Table'[Project NameID] )

        ),

        'Table'[Commit Hrs]

    )

RETURN

    SUMMARIZE (

        'Table',

        [WorkCategoryValue],

        [Project NameID],

        'Table'[ResourceRoleValue],

        'Table'[ResourceNameId],

        'Table'[TaskDetail],

        'Table'[Date],

        "Demand Hrs", _MAXDH,

        "Gap Hours", _MAXGH,

        "Commit Hrs", _MAXCS

    )

Result:

2.png

You can download the pbix file from this link: Keeping null values in aggregation table

 

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

 

Best Regards,

Rico Zhou

View solution in original post

6 REPLIES 6
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

I build the same table as yours to have a test.

1.png

Just like mwegener replied before you when you summarize ,you dont need to add the BlankCommitFlag.

I build Measure to achieve your goal.

'AGG_REsource Request =

VAR _MAXDH =

    MAXX (

        FILTER (

            ALL ( 'Table' ),

            'Table'[Project NameID] = MAX ( 'Table'[Project NameID] )

        ),

        'Table'[Demand Hrs]

    )

VAR _MAXGH =

    MAXX (

        FILTER (

            ALL ( 'Table' ),

            'Table'[Project NameID] = MAX ( 'Table'[Project NameID] )

        ),

        'Table'[Gap Hours]

    )

VAR _MAXCS =

    MAXX (

        FILTER (

            ALL ( 'Table' ),

            'Table'[Project NameID] = MAX ( 'Table'[Project NameID] )

        ),

        'Table'[Commit Hrs]

    )

RETURN

    SUMMARIZE (

        'Table',

        [WorkCategoryValue],

        [Project NameID],

        'Table'[ResourceRoleValue],

        'Table'[ResourceNameId],

        'Table'[TaskDetail],

        'Table'[Date],

        "Demand Hrs", _MAXDH,

        "Gap Hours", _MAXGH,

        "Commit Hrs", _MAXCS

    )

Result:

2.png

You can download the pbix file from this link: Keeping null values in aggregation table

 

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

 

Best Regards,

Rico Zhou

Hi @Anonymous,

 

how you aggregated the data?

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Anonymous
Not applicable

mwegener, 

 

I first added the following column to the source data set to identify null values in the data set (I realize that null values are replaced by 0 values in aggregation tables):

BlankCommitFlag = IF(ISBLANK([Commit Hours]), "Y", "N"

 

Then in the Data View, Modelling > Create Table

 

'AGG_REsource Request = SUMMARIZE('FACT_ResourceRequestList',[WorkCategoryValue],[ProjectNameId],[Tier34OrgId],' etc. to build out the aggregated table. 

 

I hope that helps, 

 

ixdutt

Hi @Anonymous 

 

do not include the column BlankCommitFlag in your SUMMARIZE

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


amitchandak
Super User
Super User

@Anonymous , it not coming in one row because of CommitFlag, it has value Y and N. Take Max for that?

 

Typically Numbers has default aggregation as a sum. That should add up to one row.  Or use some aggregation for Demand Hrs ,Commit Hrs

Anonymous
Not applicable

Amit, 

 

Thanks for your reply, but does the MAX() function apply to Y\N values in a column? I thought the function only applies to numeric values only. 

 

ixdutt

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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