cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jiangmei_wu
Frequent Visitor

Occurrence Issue

Hello,

The occurrence dax below can get the correct results with small test sample generated from real date, but when it's with real data, the resuts are incorrect. do you know why?

 
1 time =
VAR SummaryTable =
    SUMMARIZE( 'Sheet1'Sheet1'[Name]'Sheet1'[Week number],  "Occurrences",
        CALCULATE(COUNTROWS('Sheet1'),
            ALLEXCEPT('Sheet1', 'Sheet1'[Name], 'Sheet1'[Week number])))
RETURN
COUNTROWS(
    FILTER( SummaryTable,  [Occurrences] = 1))
 
Thanks, Mei
1 ACCEPTED SOLUTION

Hi Neeco, please discard the request above. I found a solution as below. Thanks, Mei

 
Names_occurred_3 =
DIVIDE(
    CALCULATE(
    COUNTROWS('Raw Data'),
    FILTER(
        'Raw Data',
        not(ISBLANK('Raw Data'[Name])) &&
        COUNTROWS(
            FILTER(
                'Raw Data',
                'Raw Data'[Name] = EARLIER('Raw Data'[Name])
            )
        ) = 3
    )
), 3
)

View solution in original post

5 REPLIES 5
MeiJiang
New Member

Can someone resolve it?

 

for date Sept 3rd, Location A, here are the results should be: 

LocationA
OccurrenceCount
Five1
One47
Three5
Two10

 

Here is Power BI Results:

MeiJiang_0-1695408380165.png

Please see attached:

Occurrence.pbix

Sample - Validate Occurrence.xlsx

 

Many thanks,

Mei

@v-tangjie-msft 

Hi Neeco, hope all is well! you have helped me resolved one problem. Hope you could squeeze some times to look into my another issue - Occurrence issue (please don't use occurrence column in Excel as it is mannually added to use for validation) which no one has been able to resolved it.

Thanks in advance!

Mei

Hi Neeco, please discard the request above. I found a solution as below. Thanks, Mei

 
Names_occurred_3 =
DIVIDE(
    CALCULATE(
    COUNTROWS('Raw Data'),
    FILTER(
        'Raw Data',
        not(ISBLANK('Raw Data'[Name])) &&
        COUNTROWS(
            FILTER(
                'Raw Data',
                'Raw Data'[Name] = EARLIER('Raw Data'[Name])
            )
        ) = 3
    )
), 3
)
parry2k
Super User
Super User

@Jiangmei_wu it will be easier if you share some sample data with the expected output to help. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi Parry,

 

Here is the excel sample data:

https://1drv.ms/x/s!Apm9aBtUDQ5yihI0wWHxSctdjOun?e=KOerr9

Here are the correct results:

Jiangmei_wu_0-1695124347248.png

Thanks,

Mei

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors