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
Puja
Helper III
Helper III

Help with SUMMARIZE

Hi All,

I am trying to get correct totals but I am not able to include blank RegionCode data. Can someone help me .Thanks

Puja_0-1685053814756.png

 

Measure=
VAR a =
    SUMX(
        SUMMARIZE(DimRegion, DimRegion[RegionCode], "AA", [Constant USD]) ,[AA])
       
RETURN  a
1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @Puja ,

 

To include blank RegionCode data in your Power BI Desktop table visual, you can modify your DAX measure to include a condition that checks for blank values. Here's an example of how you can modify your measure:

Measure = 
VAR a =
    SUMX(
        SUMMARIZE(DimRegion, DimRegion[RegionCode], "AA", [Constant USD]), [AA]
    )
VAR b =
    CALCULATE(
        [AA],
        FILTER(DimRegion, ISBLANK(DimRegion[RegionCode]))
    )
RETURN 
    IF(
        ISBLANK(a),
        b,
        IF(
            ISBLANK(b),
            a,
            a + b
        )
    )

 

In this modified measure, we first calculate the sum of the non-blank values using the same formula as before. We then calculate the sum of the blank values using the CALCULATE and FILTER functions. Finally, we add the two sums together to get the total.


Note that this assumes that the RegionCode column is a text column. If it is a numeric column, you can modify the ISBLANK function to use BLANK instead.

 

 

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.           

 

View solution in original post

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @Puja ,

 

To include blank RegionCode data in your Power BI Desktop table visual, you can modify your DAX measure to include a condition that checks for blank values. Here's an example of how you can modify your measure:

Measure = 
VAR a =
    SUMX(
        SUMMARIZE(DimRegion, DimRegion[RegionCode], "AA", [Constant USD]), [AA]
    )
VAR b =
    CALCULATE(
        [AA],
        FILTER(DimRegion, ISBLANK(DimRegion[RegionCode]))
    )
RETURN 
    IF(
        ISBLANK(a),
        b,
        IF(
            ISBLANK(b),
            a,
            a + b
        )
    )

 

In this modified measure, we first calculate the sum of the non-blank values using the same formula as before. We then calculate the sum of the blank values using the CALCULATE and FILTER functions. Finally, we add the two sums together to get the total.


Note that this assumes that the RegionCode column is a text column. If it is a numeric column, you can modify the ISBLANK function to use BLANK instead.

 

 

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.           

 

ppm1
Solution Sage
Solution Sage

Try summarizing your fact table instead. You can also simplify the expression as follows.

 

SUMX(
        SUMMARIZE(FactTableDimRegion[RegionCode])[Constant USD])
 
Pat
Microsoft Employee

hi @ppm1 

Thanks for the reply.

Your solution is not working.

 

Thank you

Can you share more about your model (show tables/relationships from diagram view), and share the [Constant USD] measure expression?

 

Pat

Microsoft Employee

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.

Top Solution Authors