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

Countif

Power BI question.jpg

 

Hi, I am farily new to Dax and I need to replicate in Power BI this formula I have on Excel. I need to create a calculated in Power Bi that  will look for how many times a number appears on a Column name DEL Delivery Reference and if it appears 1 time, the result should be 1 in the calculated column, if it appears 2 times, the result should 0.5 (1/2), if it appears 3 times the resul should be 0,3333 (1/3), and so on. 

Any help would be deeply appreciated. 

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file whether it suits your inquiry.

 

Jihwan_Kim_0-1704818247913.png

 

 

Calculated column expected result =
DIVIDE (
    1,
    COUNTROWS (
        FILTER (
            Data,
            Data[DEL Delivery reference] = EARLIER ( Data[DEL Delivery reference] )
        )
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

MarcioB
Regular Visitor

It worked just fine. Thank you very much for the prompt help. Best Regards

View solution in original post

2 REPLIES 2
MarcioB
Regular Visitor

It worked just fine. Thank you very much for the prompt help. Best Regards

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file whether it suits your inquiry.

 

Jihwan_Kim_0-1704818247913.png

 

 

Calculated column expected result =
DIVIDE (
    1,
    COUNTROWS (
        FILTER (
            Data,
            Data[DEL Delivery reference] = EARLIER ( Data[DEL Delivery reference] )
        )
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.