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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

DAX command

Hello, 

i need create new column:  values under same project (rivile_code) show all values with type "Faktas" in column "Tipas", and then values with type "Planas" only if on the same day there is no values with type "Faktas". i.e. on 2020-06-30 - 76500,65 ..... but in 2021-05-31 - 73636,36 and so on.

thank you for help.

Capture.JPG

 

 

2 ACCEPTED SOLUTIONS
wdx223_Daniel
Super User
Super User

@Anonymous try this in a calculated column

=IF(Table[Tipas]="Planas")&&Table[value],IF(COUNTROWS(FILTER(Table,Table[Tipas]="Faktas"&&Table[Data]=EARLIER(Table[Data])&&Table[rivile_code]=EARLIER(Table[rivile_code]))),"Yes","No"))

View solution in original post

CNENFRNL
Community Champion
Community Champion

Hi, @Anonymous , you might want to try this formula in a calculated column

Column =
VAR __t =
    CALCULATETABLE (
        'Table',
        ALLEXCEPT ( 'Table', 'Table'[rivile_code], 'Table'[Data] )
    )
VAR __t_faktas =
    FILTER ( __t, 'Table'[Tipas] = "Faktas" )
RETURN
    IF (
        COUNTROWS ( __t_faktas ),
        CALCULATE ( MAX ( 'Table'[value] ), __t_faktas ),
        CALCULATE ( MAX ( 'Table'[value] ), FILTER ( __t, 'Table'[Tipas] = "Planas" ) )
    )

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

just thanked but stucked after next few steps til nice finish. Asking for help about wrong total in matrix. I watched all videos and post's about that problem, but in all of them there are too simple examples, and in my situation can't find how to apply them. Thank you in advance.

Formula for better understanding:

 

Sutarčių vertė = SUMX(GROUPBY('kp_database project_contract','kp_database project_contract'[contract_number], 'kp_database project_contract'[name.1], "MAXSUM",maxx(CURRENTGROUP(),'kp_database project_contract'[Custom.1])),[MAXSUM])
 ----->
Sut likutis (NAUJAS) =
IF(ISBLANK([Sutarčių vertė]),BLANK(),
CALCULATE([Sutarčių vertė]-
SUMX(GROUPBY('kp_database project_contract','kp_database project_contract'[contract_number],'kp_database project_contract'[name.1],'kp_database project_contract'[code],'kp_database project_contract'[name], 'kp_database project_contract'[year],'kp_database project_contract'[month],"MAXSUM",maxx(CURRENTGROUP(),'kp_database project_contract'[Likučio sąlyga])),[MAXSUM]),
FILTER (ALL ( 'kp_database project_contract'[Data].[Date]),'kp_database project_contract'[Data].[Date] <= MAX('kp_database project_contract'[Data].[Date]))))
 

Capture.PNG 

Anonymous
Not applicable

Thank you for your time and solution guys! Good day.

CNENFRNL
Community Champion
Community Champion

Hi, @Anonymous , you might want to try this formula in a calculated column

Column =
VAR __t =
    CALCULATETABLE (
        'Table',
        ALLEXCEPT ( 'Table', 'Table'[rivile_code], 'Table'[Data] )
    )
VAR __t_faktas =
    FILTER ( __t, 'Table'[Tipas] = "Faktas" )
RETURN
    IF (
        COUNTROWS ( __t_faktas ),
        CALCULATE ( MAX ( 'Table'[value] ), __t_faktas ),
        CALCULATE ( MAX ( 'Table'[value] ), FILTER ( __t, 'Table'[Tipas] = "Planas" ) )
    )

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

amitchandak
Super User
Super User

@Anonymous , Try a new column like

if(isblank([values]) ,
sumx(filter(Table, [Tipas] ="Planas" && [rivile_code] = earlier([rivile_code]) && [Data] =earlier([Data])),[values]),[values])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
wdx223_Daniel
Super User
Super User

@Anonymous try this in a calculated column

=IF(Table[Tipas]="Planas")&&Table[value],IF(COUNTROWS(FILTER(Table,Table[Tipas]="Faktas"&&Table[Data]=EARLIER(Table[Data])&&Table[rivile_code]=EARLIER(Table[rivile_code]))),"Yes","No"))

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.