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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
PuneethERB
Regular Visitor

Power BI DAX No Data Calculation

Hi All,

[Referring to the screenshot] About the data: I've prepared the model where in the 'Date' as seen in the screenshot is an intermediate table and 'Code' is also an intermediate table and the Measures 'Visits Total' & 'IA visits','Vacation Visits' are from different tables. These tables primary dates and codes columns are connected to the intermediate table.

Requirement: if (any of the measure has no data/0 then i want the result as 'Count the respective date as 1 day' ) the result i wanted is highlighted in the RED color in screenshot.

Hoping for the DAX help on this.Would be grateful for the help in this regard. Thanks.dax help1.png

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

Hi @PuneethERB ,

 

You could create two measures.

Measure =
VAR a =
    PRODUCTX (
        FILTER (
            'Table',
            'Table'[Value] IN { BLANK (), 0 }
                && (
                    CALCULATE ( SUM ( 'Table'[Value] ), ALLEXCEPT ( 'Table', 'Table'[Date] ) ) = 0
                )
        ),
        1
    )
RETURN
    IF (
        NOT ( ISINSCOPE ( 'Table'[Type] ) ) && ISINSCOPE ( 'Table'[Date] )
            && SELECTEDVALUE ( 'Table'[Value] ) IN { BLANK (), 0 },
        a,
        SUM ( 'Table'[Value] )
    )
Measure new = 
SUMX(VALUES('Table'[Date]),[Measure])

Then put "Measure new" into Values.

Here is the result.

2-1.PNG

Here is my test file for your reference.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

1 REPLY 1
v-eachen-msft
Community Support
Community Support

Hi @PuneethERB ,

 

You could create two measures.

Measure =
VAR a =
    PRODUCTX (
        FILTER (
            'Table',
            'Table'[Value] IN { BLANK (), 0 }
                && (
                    CALCULATE ( SUM ( 'Table'[Value] ), ALLEXCEPT ( 'Table', 'Table'[Date] ) ) = 0
                )
        ),
        1
    )
RETURN
    IF (
        NOT ( ISINSCOPE ( 'Table'[Type] ) ) && ISINSCOPE ( 'Table'[Date] )
            && SELECTEDVALUE ( 'Table'[Value] ) IN { BLANK (), 0 },
        a,
        SUM ( 'Table'[Value] )
    )
Measure new = 
SUMX(VALUES('Table'[Date]),[Measure])

Then put "Measure new" into Values.

Here is the result.

2-1.PNG

Here is my test file for your reference.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.