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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Ginjko
Regular Visitor

Need help on calculate behavior

Hello there, I am fairly new to dax and I still struggle with a lot of the simple concepts. I have been stuck on an issue for 4 days now and I need help. I ll try to describe my problem as good as I can...I hope it is easy solve.

I have a measure called [Average daily count] wich works fine and I need to display it in a matrice, but I want to filter it to remove unrelevent data. 

 

here is my visual, I have highlighted the data to be removed

 

Matrice 1.PNG

 

 

 

 

 

 

now I have managed to isolate the unwanted data using this measure on top of my [Average Daily Count Measure]

 

 

Correct Average daily count Try =

CALCULATE(
    [Average daily count],
    KEEPFILTERS(
        FILTER(
            CROSSJOIN(
                ALL (Clock[Working Hour]),
                All ('Date'[Day of Week Number])
            ),
            Clock[Working Hour] = 8
&& 'Date'[Day of Week Number] = 7 //day of week number = 7 gives me sunday
        )
    )
)

 

Here is the same matrice filtered with this new measure.

 

Matrice 2.png

 

 

Then I thought, Ok too easy, replace = (equal to) by <> (is not ... if i am not mistaken)... and i should then filter this out of my matrix...

But it doesn't work

Here is the result, it just remove all the 8th hour row and all the sunday column

 

Matrice 3.png

 

 

 

 

 

 

 

I tried for hours, read all I could, I can't figure out why and I just get more and more confused.

Could it be that I am using the wrong logical operator somewhere down the line ? 

Any help would be greatly appraciated.

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

Just change the && to || in your expression, or you can try this approach instead

 

NewMeasure =
VAR result = [Average Daily Count]
RETURN
    IF (
        MIN ( Clock[Working Hour] ) = 8
            && MIN ( 'Date'[Day of Week Number] ) = 7,
        BLANK (),
        result
    )

 
Regards,
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Ginjko,

I think mahoneypat's suggestion should help.
In addition, you can also share some dummy data with raw table structure to help us clarify them and test to coding formula if these expressions do not work on your side.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
mahoneypat
Employee
Employee

Just change the && to || in your expression, or you can try this approach instead

 

NewMeasure =
VAR result = [Average Daily Count]
RETURN
    IF (
        MIN ( Clock[Working Hour] ) = 8
            && MIN ( 'Date'[Day of Week Number] ) = 7,
        BLANK (),
        result
    )

 
Regards,
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Still Cannot understand why yet but I replaced the && by ||  ... and It works like a treat.
Thanks a lot for your time and help.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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