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
FILIPKACZMAR
Advocate I
Advocate I

Problem with SUM and Calculate function

Hello my friends,

I have a question for you and I hope you can help me (as always) 🙂 

I wrote a code: 

cost of NOI =
IF(
    ISFILTERED('SQA list 2022'[Date of witness].[Date] ),
    ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
    TOTALYTD(
 
        CALCULATE ( SUM ('Rates'[Hourly rate]) * SUM ('SQA list 2022'[Total Duration ( Hours )])),'SQA list 2022'[Date of witness].[Date]
))


Everything works perfect, but when I want to use this measure with other at one column chart it stops working. Is it because other measures have got diffrent date function? (no Date of witness)

Thank you for help all 🙂

4 REPLIES 4
amitchandak
Super User
Super User

@FILIPKACZMAR , You should push the hourly rate multiplcation at line level

 

Like

SUMX('SQA list 2022', 'SQA list 2022'[Total Duration ( Hours )] * related('Rates'[Hourly rate])  )

 

Also For Time intelligence, do not use .Date. Use Date Table and date without timestamp

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Helo, thanks for help and your time 🙂
Now I have got this error: Too few arguments were passed to the TOTALYTD function. The minimum argument count for the function is 2.

I am new at power bi, so maybe I miss something

@FILIPKACZMAR , Try like

 

TOTALYTD(
CALCULATE ( SUMX('SQA list 2022', 'SQA list 2022'[Total Duration ( Hours )] * related('Rates'[Hourly rate]) )),'Date'[Date]
)

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

FILIPKACZMAR
Advocate I
Advocate I

FILIPKACZMAR_0-1657521627336.png

In the picture you can see, that cos of noi gives two diffrent values 😞

 

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.

Top Solution Authors