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
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
Regular Visitor

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
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.