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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Sania-F
Resolver I
Resolver I

DAX modification help needed

HI All,

Please help in getting expected data.

 

I have  date table with columns [isEndOfQuarter] with values yes, no and [isCurrentFiscalYear] with values yes, no.

I have a time-period table with column [mon-fyyear] with vaues as sep-fy24,oct-fy24,nov-fy24,dec-fy24,jan-fy24,feb-fy24 and so on

I have a factEMT table with column [rev pln], factunit table, factgroup table with column [value]

For last fiscal year , I should show sum(factemt[revplan])

Whenever the pbi page scope is in selected unit and selected group
 if the select the mon-yyyear is -> isCurrentFiscalYear = yes  and [isendofquarter]= yes and, then I should see quarter related totals

 if the select the mon-yyyear is -> isCurrentFiscalYear = yes  and [isendofquarter]= No and, then I should see fiscalyear related totals.

Data comes fine when I see EOQ total. The moment I try to see FYtotal , I see only Fytotal across all units and group

 

 

Data expected at Fytotal :

MarketUnit

ClientGroup

Plan M$

M1

CG1

100$

M1

cg2

500$

M1

cg3

700$

M1

cg4

300$

M1

cg5

1000$

M1 totsl

 

2600$

M2

CG1

900$

M2

cg2

200$

M2

cg3

550$

M2

cg4

130$

M2

cg5

100$

m2 total

 

1880$

TOTAL

 

4480

 

 

Data that I am getting as fytotal :

 

MarketUnit

ClientGroup

Plan M$

M1

CG1

4480

M1

cg2

4480

M1

cg3

4480

M1

cg4

4480

M1

cg5

4480

 

 

4480

M2

CG1

4480

M2

cg2

4480

M2

cg3

4480

M2

cg4

4480

M2

cg5

4480

 

 

4480

TOTAL

 

4480

 

 

DAX written –

 

rev pln sf2 =

VAR p = SELECTEDVALUE(time-period[Month-year])

VAR EOQtotal = CALCULATE(SUM(factemt[Value]), 'FactEMEAPlanTotal'[Metrics] = "REV", dimDate[isendofquarter] = "Yes")

VAR EOQunittotal = CALCULATE(SUM(factunit[Value]), factunit [Metrics] = "REV", DimDate[isendofquarter] = "Yes")

VAR EOQgrouptotal = CALCULATE(SUM('Factgroup'[Value]), ''Factgroup' [Metrics] = "REV", DimDate[isendofquarter] = "Yes")

var fytotal= CALCULATE(SUM(factemt [Revenue Plan ($)])/1000, factemt [LoadDateKey]=MAX(factemt [LoadDateKey]))

RETURN

    SWITCH (

        TRUE(),

       p IN { "Oct-FY23",so on………, "Aug-FY23" },

        CALCULATE(SUM(FactEMT[RevPln ($)]) / 1000, FactEMt[DateKey] = 20221130),

        // If DimDate[currentfiscalyear] is "Yes" and DimDate[FlagEndOfFisFiscalQuarter] is "No", return FYtotal

        IF (

            SELECTEDVALUE(DimDate[iscurrentfiscalyear]) = "Yes" &&

            SELECTEDVALUE(DimDate[isendofquarter]) = "No",

            FYtottal,

            // If the above condition is not met, return EOQtotal, EOQmutotal, or EOQmucg based on other conditions

            IF (

                ISINSCOPE(Dunit[unit]) && ISINSCOPE(DimGroup[Group]),

                EOQgrouptotal,

                IF (

                    HASONEFILTER(Dunit[Unit]),

                    EOQunittotal,

                    EOQtotal

                )

            )

        )

    )
 

 

1 REPLY 1
Sahir_Maharaj
Super User
Super User

Hello @Sania-F,

 

Can you please try this streamlined version of your measure:

 

Revised Rev Plan SF2 = 
VAR IsCurrentFY = SELECTEDVALUE(DimDate[iscurrentfiscalyear]) = "Yes"
VAR IsEndOfQuarter = SELECTEDVALUE(DimDate[isendofquarter]) = "Yes"
VAR LatestLoadDate = MAX(factemt[LoadDateKey])
RETURN
    IF (
        IsEndOfQuarter,
        SUM(factemt[Value]),
        IF (
            IsCurrentFY,
            CALCULATE(
                SUM(factemt[Revenue Plan ($)]) / 1000,
                ALLSELECTED(DimDate),
                DimDate[iscurrentfiscalyear] = "Yes",
                DimDate[LoadDateKey] = LatestLoadDate
            ),
            BLANK()
        )
    )

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.