skip to main content
Power BI
    • What is Power BI
    • Why Power BI
    • Customer stories
    • Data visuals
    • Security
    • Power BI Desktop
    • Power BI Pro
    • Power BI Premium
    • Power BI Mobile
    • Power BI Embedded
    • Power BI Report Server
  • Pricing
    • Azure + Power BI
    • Microsoft 365 + Power BI
    • Dynamics 365 + Power BI
      • Energy
      • Healthcare
      • Manufacturing
      • Media
      • Retail
    • For analysts
    • For IT
      • Overview
      • Embedded analytics
      • Power BI visuals
      • Automation
      • Documentation
      • Community
    • Overview
    • Find consulting services
    • Partner showcase
    • Find a partner
    • Become a partner
    • Instructor-led training
    • Getting started
      • Overview
      • Self-guided learning
      • Webinars
      • Documentation
      • Roadmap
      • Overview
      • Issues
      • Give feedback
    • Blog
    • Business intelligence topics
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • Events
    • User groups
    • Community blog
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Microsoft Power BI Community
    • Welcome to the Community!
    • News & Announcements
    • Get Help with Power BI
    • Desktop
    • Service
    • Report Server
    • Power Query
    • Mobile Apps
    • Developer
    • DAX Commands and Tips
    • Custom Visuals Development Discussion
    • Health and Life Sciences
    • Power BI Spanish Community
    • Translated Spanish Desktop
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Training and Consulting
    • Instructor Led Training
    • Galleries
    • Community Connections & How-To Videos
    • COVID-19 Data Stories Gallery
    • Themes Gallery
    • Data Stories Gallery
    • R Script Showcase
    • Webinars and Video Gallery
    • Quick Measures Gallery
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Events
    • Ideas
    • Custom Visuals Ideas
    • Issues
    • Issues
    • Events
    • Upcoming Events
    • Community Engagement
    • T-Shirt Design Challenge 2023
    • Community Blog
    • Power BI Community Blog
    • Custom Visuals Community Blog
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power BI Community
    • Galleries
    • Quick Measures Gallery
    • F.DIST

    F.DIST

    05-09-2020 11:07 AM - last edited 05-12-2020 20:52 PM

    Super User Greg_Deckler
    Super User
    1120 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    Greg_Deckler
    Super User Greg_Deckler
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    F.DIST

    ‎05-09-2020 11:07 AM

    In my recent quest to create or catalog as many DAX equivalents for Excel functions was able to leverage my work on GAMMA to come up with F.DIST.

     

     

    F.THIS = 
        VAR __x = [x]
        VAR __Deg1 = [Deg_freedom1]
        VAR __Deg2 = [Deg_freedom2]
        VAR __GAMMA1 = 
            VAR __zInput = (__Deg2 + __Deg1) / 2
            VAR __p =
                {
                    (0, 676.5203681218851),
                    (1, -1259.1392167224028),
                    (2, 771.32342877765313),
                    (3, -176.61502916214059),
                    (4, 12.507343278686905),
                    (5, -0.13857109526572012),
                    (6, 9.9843695780195716e-6),
                    (7, 1.5056327351493116e-7)
                }
            VAR __EPSILON = 1e-7
            VAR __z = IF(__zInput < 0.5, 1 - __zInput - 1,__zInput - 1)
            VAR __pTable = 
                ADDCOLUMNS(
                    __p,
                    "x",[Value2] / (__z + [Value1] + 1)
                )
            VAR __x = 0.99999999999980993 + SUMX(__pTable,[x])
            VAR __t = __z + COUNTROWS(__pTable) - .5
            VAR __y = 
                IF(
                    __zInput < 0.5,
                    PI() / (SIN(PI() * __zInput) * SQRT(2*PI()) * POWER(__t,__z+0.5) * EXP(-1*__t) * __x),
                    SQRT(2*PI()) * POWER(__t,__z+0.5) * EXP(-1*__t) * __x
                )
        RETURN
            __y
        VAR __GAMMA2 = 
            VAR __zInput = (__Deg1) / 2
            VAR __p =
                {
                    (0, 676.5203681218851),
                    (1, -1259.1392167224028),
                    (2, 771.32342877765313),
                    (3, -176.61502916214059),
                    (4, 12.507343278686905),
                    (5, -0.13857109526572012),
                    (6, 9.9843695780195716e-6),
                    (7, 1.5056327351493116e-7)
                }
            VAR __EPSILON = 1e-7
            VAR __z = IF(__zInput < 0.5, 1 - __zInput - 1,__zInput - 1)
            VAR __pTable = 
                ADDCOLUMNS(
                    __p,
                    "x",[Value2] / (__z + [Value1] + 1)
                )
            VAR __x = 0.99999999999980993 + SUMX(__pTable,[x])
            VAR __t = __z + COUNTROWS(__pTable) - .5
            VAR __y = 
                IF(
                    __zInput < 0.5,
                    PI() / (SIN(PI() * __zInput) * SQRT(2*PI()) * POWER(__t,__z+0.5) * EXP(-1*__t) * __x),
                    SQRT(2*PI()) * POWER(__t,__z+0.5) * EXP(-1*__t) * __x
                )
        RETURN
            __y
        VAR __GAMMA3 = 
            VAR __zInput = (__Deg2) / 2
            VAR __p =
                {
                    (0, 676.5203681218851),
                    (1, -1259.1392167224028),
                    (2, 771.32342877765313),
                    (3, -176.61502916214059),
                    (4, 12.507343278686905),
                    (5, -0.13857109526572012),
                    (6, 9.9843695780195716e-6),
                    (7, 1.5056327351493116e-7)
                }
            VAR __EPSILON = 1e-7
            VAR __z = IF(__zInput < 0.5, 1 - __zInput - 1,__zInput - 1)
            VAR __pTable = 
                ADDCOLUMNS(
                    __p,
                    "x",[Value2] / (__z + [Value1] + 1)
                )
            VAR __x = 0.99999999999980993 + SUMX(__pTable,[x])
            VAR __t = __z + COUNTROWS(__pTable) - .5
            VAR __y = 
                IF(
                    __zInput < 0.5,
                    PI() / (SIN(PI() * __zInput) * SQRT(2*PI()) * POWER(__t,__z+0.5) * EXP(-1*__t) * __x),
                    SQRT(2*PI()) * POWER(__t,__z+0.5) * EXP(-1*__t) * __x
                )
        RETURN
            __y
    RETURN
        DIVIDE(__GAMMA1,__GAMMA2 * __GAMMA3) * 
            POWER(__Deg1/__Deg2,__Deg1/2) *
                DIVIDE(
                    POWER(__x,(__Deg1-2)/2),
                    POWER(1+(__Deg1/__Deg2)*__x,(__Deg1+__Deg2)/2)
                )

     

    The cumulative form of F.DIST is:

    F.THIS.CUMULATIVE = 
        VAR __x = [x]
        VAR __df1 = [Deg_freedom1]
        VAR __df2 = [Deg_freedom2]
    RETURN
        BETA.DIST(
            __x*__df1/(__x*__df1+__df2),
            __df1/2,
            __df2/2,
            TRUE
        )

    F.DIST.RT is:

    F.THIS.RT = 1 - [F.THIS.CUMULATIVE]

    F.INV is this:

     

    F.INV = 
        VAR __p = [F.THIS.CUMULATIVE]
        VAR __df1 = [Deg_freedom1]
        VAR __df2 = [Deg_freedom2]
    RETURN
        BETA.INV(__p,__df1/2,__df2/2) * __df2/(__df1*(1-BETA.INV(__p,__df1/2,__df2/2)))

     

    And last but not least, F.INV.RT:

    F.INV.RT = 
        VAR __p = 1 - [F.THIS.RT]
        VAR __df1 = [Deg_freedom1]
        VAR __df2 = [Deg_freedom2]
    RETURN
        BETA.INV(__p,__df1/2,__df2/2) * __df2/(__df1*(1-BETA.INV(__p,__df1/2,__df2/2)))

    Thank goodness for actual documentation:

    • https://support.minitab.com/en-us/minitab-express/1/help-and-how-to/basic-statistics/probability-dis...
    • http://www.real-statistics.com/chi-square-and-f-distributions/f-distribution/

    eyJrIjoiOGRlZDc0OTUtMjE3MC00Mjg4LTgxZTktMDEzMDkxNzEzZjUxIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9


    @ me in replies or I'll lose your thread!!!
    Instead of a Kudo, please vote for this idea
    Become an expert!: Enterprise DNA
    External Tools: MSHGQM
    YouTube Channel!: Microsoft Hates Greg
    Latest book!:
    Mastering Power BI 2nd Edition

    DAX is easy, CALCULATE makes DAX hard...
    Preview file
    59 KB
    FTHIS.pbix
    Labels:
    • Labels:
    • Mathematical
    • Other
    Message 1 of 2
    1,120 Views
    1
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic
    Barendnu
    Barendnu Advocate III
    Advocate III
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-31-2021 05:10 AM

    Thank you very much! I was looking for the equivalent of Statistics.FDistribution in DAX, and this works great, very handy indeed!

    Message 2 of 2
    645 Views
    2
    Reply

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    • Sign in
    • Sign up

    Browse

    • Solutions
    • Partners
    • Consulting Services

    Downloads

    • Power BI Desktop
    • Power BI Mobile
    • Power BI Report Server
    • See all downloads

    Learn

    • Guided learning
    • Documentation
    • Support
    • Community
    • Give feedback
    • Webinars
    • Developers
    • Blog
    • Newsletter

    © 2023 Microsoft

    Follow Power BI

    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Trademarks
    Consumer Privacy Act (CCPA) Opt-Out Icon Your Privacy Choices