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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Reversing DAX statement

Hi, can someone help?

I need this DAX calculation, but the other way around:
@ https://community.powerbi.com/t5/Quick-Measures-Gallery/Transitive-Closure/td-p/783828

 

(Output > DAX > Input)

 

Thanks for your help!

2 REPLIES 2
wdx223_Daniel
Super User
Super User

@Anonymous maybe this is what you want

wdx223_Daniel_1-1604031877993.png

here is the code

Input = VAR t=
SELECTCOLUMNS (
    GENERATE (
        GENERATE (
            ADDCOLUMNS (
                Output,
                "@path", SUBSTITUTE ( Output[Destinations], ";", "|" ),
                "@n",
                    LEN ( Output[Destinations] )
                        - LEN ( SUBSTITUTE ( Output[Destinations], ";", "" ) ) + 1
            ),
            GENERATESERIES ( 1, [@n], 1 )
        ),
        ROW ( "To", PATHITEM ( [@path], [Value] ) )
    ),
    "From", [From],
    "To", [To]
)
RETURN 
FILTER(t,VAR fr=[From] VAR tt=[To] RETURN COUNTROWS(FILTER(t,[From]=tt||[To]=fr)))
Anonymous
Not applicable

What does it mean "other way round"? There is no 1-1 correspondence from a relation to its transitive closure, so you can't really do what you require.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.