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
eliasayyy
Memorable Member
Memorable Member

Why am i not getting correct values

IMG-20230329-WA0098.jpg

 

I have this formula and for august it says 12089 in reality i only have 2

 

IMG-20230329-WA0099.jpg

If i make a measure for each calculation then put the measure inside it works but i dont want to make measures i want to do everything in this table how?

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@eliasayyy That's a really bizarre construct. Can't you just unpivot your 4 columns in Power Query? That would make this super simple. If not, you can do this:

New Table 1 = 
    VAR __Months = 
        DISTINCT(
            SELECTCOLUMNS(
                ADDCOLUMNS(
                    'Table1',
                    "Month", FORMAT([Date], "MMMM")
                ),
                "Month",[Month]
            )
        )
    VAR __Fields = { "Pageviews", "Entrances", "Exits", "Bounces" }
    VAR __Table = GENERATE( __Months, __Fields )
    VAR __Result = 
        SELECTCOLUMNS(
            ADDCOLUMNS(
                __Table,
                "Total",
                SWITCH([Value],                    
                    "Pageviews", SUMX(FILTER('Table1', FORMAT([Date], "MMMM") = [Month]),[Pageviews]),
                    "Entrances", SUMX(FILTER('Table1', FORMAT([Date], "MMMM") = [Month]),[Entrances]),
                    "Exits", SUMX(FILTER('Table1', FORMAT([Date], "MMMM") = [Month]),[Exits]),
                    "Bounces", SUMX(FILTER('Table1', FORMAT([Date], "MMMM") = [Month]),[Bounces])
                )
            ),
            "Fields",[Value],
            "Month",[Month],
            "Total",[Total]
        )
RETURN
    __Result


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.