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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
zibster
Helper III
Helper III

Daily Percent of week

Hi,

I am trying to get daily percent of total week projection and I dont know what am I doing wrong, please help.

 

Measure = DIVIDE(SUM(SLYProj[Sales]),CALCULATE(SUM(SLYProj[Sales]),FILTER(DatesTB,DatesTB[WEEK] = DatesTB[WEEK])))
 
Thanks
Z
1 ACCEPTED SOLUTION
zoloturu
Memorable Member
Memorable Member

Hi @zibster ,

 

Try this one

Measure =
VAR __week =
    MAX ( 'DatesTB'[WEEK] )

RETURN
    DIVIDE (
        SUM ( 'SLYProj'[Sales] ),
        CALCULATE (
            SUM ( 'SLYProj'[Sales] ),
            FILTER ( ALL ( 'DatesTB' ), 'DatesTB'[WEEK] = __week )
        )
    )

Tip1. If you use FILTER function to calculate an expression in different context then most of the time you need to remove all filters using a function ALL.

 

Tip2. Also, we need to mention a proper filter by a week of current context. In a measures you can't enter "= some column", so  to get a value of a week we need to use a function MAX (or in some cases LASTDATE/SELECTEDVALUE).


Regards,
Ruslan Zolotukhin (zoloturu)
BI Engineer at Akvelon Inc. / Kharkiv Power BI User Group Leader / DAX & Power BI Trainer
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!

You are from Ukraine? If yes then welcome to Power BI User Group - KhPUG website. Other country? Check and find proper one - Power BI User Groups

View solution in original post

4 REPLIES 4
zoloturu
Memorable Member
Memorable Member

Hi @zibster ,

 

Try this one

Measure =
VAR __week =
    MAX ( 'DatesTB'[WEEK] )

RETURN
    DIVIDE (
        SUM ( 'SLYProj'[Sales] ),
        CALCULATE (
            SUM ( 'SLYProj'[Sales] ),
            FILTER ( ALL ( 'DatesTB' ), 'DatesTB'[WEEK] = __week )
        )
    )

Tip1. If you use FILTER function to calculate an expression in different context then most of the time you need to remove all filters using a function ALL.

 

Tip2. Also, we need to mention a proper filter by a week of current context. In a measures you can't enter "= some column", so  to get a value of a week we need to use a function MAX (or in some cases LASTDATE/SELECTEDVALUE).


Regards,
Ruslan Zolotukhin (zoloturu)
BI Engineer at Akvelon Inc. / Kharkiv Power BI User Group Leader / DAX & Power BI Trainer
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!

You are from Ukraine? If yes then welcome to Power BI User Group - KhPUG website. Other country? Check and find proper one - Power BI User Groups

Hi Ruslan,

 

Sorry to bug you again, but I was trying to replicate the calculation on the table and I am getting replication, can you advise what am I doing incorrectly.

 

Thanks

Z

 

Capture.PNG

Hi @zibster ,

 

You created a calculated column, but the calculation I've provided should be a measure. So create a visual and drop fields to it.


Regards,
Ruslan Zolotukhin (zoloturu)
BI Engineer at Akvelon Inc. / Kharkiv Power BI User Group Leader / DAX & Power BI Trainer
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!

You are from Ukraine? If yes then welcome to Power BI User Group - KhPUG website. Other country? Check and find proper one - Power BI User Groups

Thansk For Your help 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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